public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Allow __ibm128 on older PowerPC systems.
@ 2021-05-18 20:36 Michael Meissner
  2021-05-20 19:29 ` will schmidt
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Michael Meissner @ 2021-05-18 20:36 UTC (permalink / raw)
  To: gcc-patches, Michael Meissner, Segher Boessenkool,
	David Edelsohn, Bill Schmidt, Peter Bergner, Will Schmidt

[PATCH] Allow __ibm128 on older PowerPC systems.

On January 8th, 2018, I added code to ibm-ldouble.c to use the built-in
function __builtin_pack_ibm128 if long double is IEEE 128-bit and continue to
use __builtin_pack_longdouble if long double is IBM extended double.  This code
was needed because __builtin_pack_ibm128 is not available unless the __ibm128
keyword is availabe.  In the current code, __ibm128 is only enabled if we have
support for both IBM and IEEE 128-bit long double.

Segher suggested that instead I should make __ibm128, __builtin_pack_ibm128,
and __builtin_unpack_ibm128 available on older systems that don't support IEEE
128-bit floating point but does support the IBM extended double floating point.

This patch changes the code so that __ibm128 is now exported if either
long double uses the IBM extended double format, or IEEE 128-bit floating
point is available.

I changed the internal built-in types from float128 to ibm128, since the
only built-in functions that use this are __builtin_pack_ibm128 and
__builtin_unpack_ibm128, and the new name matches the function.

In addition, this patch changes the function within libgcc that handles
IBM long double to use the __builtin_pack_ibm128 function.

I have done bootstrap builds with this patch on the following 3 systems:
    1)	power9 running LE Linux using --with-cpu=power9
    2)	power8 running BE Linux using --with-cpu=power8, testing both
	32/64-bit.
    3)	power10 prototype running LE Linux using --with-cpu=power10.

There were no regressions to the tests, and the new test added passed.  Can I
check these patches into trunk branch for GCC 12?

At the moment, I'm not sure this should be backported to GCC 11.  But I can
easily do the back port after a stabilizing period.

gcc/
2021-05-18  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/rs6000-builtin.def (BU_IBM128_2): Rename
	RS6000_BTM_IBM128 from RS6000_BTM_FLOAT128.
	* config/rs6000/rs6000-call.c (rs6000_invalid_builtin): Update
	error message for __ibm128 built-in functions.
	(rs6000_init_builtins): Create the __ibm128 keyword on older
	systems where long double uses the IBM extended double format,
	even if they don't support IEEE 128-bit floating point.
	* config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Rename
	RS6000_BTM_IBM128 from RS6000_BTM_FLOAT128.
	(rs6000_builtin_mask_names): Rename RS6000_BTM_IBM128 from
	RS6000_BTM_FLOAT128.
	* config/rs6000/rs6000.h (TARGET_IBM128): New macro.
	(RS6000_BTM_IBM128): Rename from RS6000_BTM_FLOAT128.
	(RS6000_BTM_COMMON): Rename RS6000_BTM_IBM128 from
	RS6000_BTM_FLOAT128.

libgcc/
2021-05-18  Michael Meissner  <meissner@linux.ibm.com>

	* config/rs6000/ibm-ldouble.c (pack_ldouble): Use
	__builtin_pack_ibm128 instead of __builtin_pack_longdouble.
---
 gcc/config/rs6000/rs6000-builtin.def |  5 ++---
 gcc/config/rs6000/rs6000-call.c      | 14 ++++++++++----
 gcc/config/rs6000/rs6000.c           |  4 ++--
 gcc/config/rs6000/rs6000.h           | 12 +++++++++---
 libgcc/config/rs6000/ibm-ldouble.c   |  4 ++--
 5 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
index 609bebdfd74..6d82ed224fb 100644
--- a/gcc/config/rs6000/rs6000-builtin.def
+++ b/gcc/config/rs6000/rs6000-builtin.def
@@ -796,13 +796,12 @@
 		     | RS6000_BTC_BINARY),				\
 		    CODE_FOR_ ## ICODE)			/* ICODE */
 
-/* 128-bit __ibm128 floating point builtins (use -mfloat128 to indicate that
-   __ibm128 is available).  */
+/* 128-bit __ibm128 floating point builtins.  */
 #define BU_IBM128_2(ENUM, NAME, ATTR, ICODE)				\
   RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM,		/* ENUM */	\
 		    "__builtin_" NAME,			/* NAME */	\
 		    (RS6000_BTM_HARD_FLOAT		/* MASK */	\
-		     | RS6000_BTM_FLOAT128),				\
+		     | RS6000_BTM_IBM128),				\
 		    (RS6000_BTC_ ## ATTR		/* ATTR */	\
 		     | RS6000_BTC_BINARY),				\
 		    CODE_FOR_ ## ICODE)			/* ICODE */
diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
index c4332a61862..7bdc4eeca5f 100644
--- a/gcc/config/rs6000/rs6000-call.c
+++ b/gcc/config/rs6000/rs6000-call.c
@@ -11540,8 +11540,8 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode)
     error ("%qs requires the %qs option", name, "-mhard-float");
   else if ((fnmask & RS6000_BTM_FLOAT128_HW) != 0)
     error ("%qs requires ISA 3.0 IEEE 128-bit floating point", name);
-  else if ((fnmask & RS6000_BTM_FLOAT128) != 0)
-    error ("%qs requires the %qs option", name, "%<-mfloat128%>");
+  else if ((fnmask & RS6000_BTM_IBM128) != 0)
+    error ("%qs requires the IBM 128-bit floating point", name);
   else if ((fnmask & (RS6000_BTM_POPCNTD | RS6000_BTM_POWERPC64))
 	   == (RS6000_BTM_POPCNTD | RS6000_BTM_POWERPC64))
     error ("%qs requires the %qs (or newer), and %qs or %qs options",
@@ -13236,7 +13236,7 @@ rs6000_init_builtins (void)
      For IEEE 128-bit floating point, always create the type __ieee128.  If the
      user used -mfloat128, rs6000-c.c will create a define from __float128 to
      __ieee128.  */
-  if (TARGET_FLOAT128_TYPE)
+  if (TARGET_IBM128)
     {
       if (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
 	ibm128_float_type_node = long_double_type_node;
@@ -13250,7 +13250,13 @@ rs6000_init_builtins (void)
 
       lang_hooks.types.register_builtin_type (ibm128_float_type_node,
 					      "__ibm128");
+    }
+
+  else
+    ibm128_float_type_node = long_double_type_node;
 
+  if (TARGET_FLOAT128_TYPE)
+    {
       if (TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
 	ieee128_float_type_node = long_double_type_node;
       else
@@ -13261,7 +13267,7 @@ rs6000_init_builtins (void)
     }
 
   else
-    ieee128_float_type_node = ibm128_float_type_node = long_double_type_node;
+    ieee128_float_type_node = long_double_type_node;
 
   /* Vector pair and vector quad support.  */
   if (TARGET_EXTRA_BUILTINS)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 44ae3adbe7a..86f53297cb9 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -3427,7 +3427,7 @@ rs6000_builtin_mask_calculate (void)
 	  | ((TARGET_LONG_DOUBLE_128
 	      && TARGET_HARD_FLOAT
 	      && !TARGET_IEEEQUAD)	    ? RS6000_BTM_LDBL128   : 0)
-	  | ((TARGET_FLOAT128_TYPE)	    ? RS6000_BTM_FLOAT128  : 0)
+	  | ((TARGET_IBM128)		    ? RS6000_BTM_IBM128    : 0)
 	  | ((TARGET_FLOAT128_HW)	    ? RS6000_BTM_FLOAT128_HW : 0)
 	  | ((TARGET_MMA)		    ? RS6000_BTM_MMA	   : 0)
 	  | ((TARGET_POWER10)               ? RS6000_BTM_P10       : 0));
@@ -24164,7 +24164,7 @@ static struct rs6000_opt_mask const rs6000_builtin_mask_names[] =
   { "hard-float",	 RS6000_BTM_HARD_FLOAT,	false, false },
   { "long-double-128",	 RS6000_BTM_LDBL128,	false, false },
   { "powerpc64",	 RS6000_BTM_POWERPC64,  false, false },
-  { "float128",		 RS6000_BTM_FLOAT128,   false, false },
+  { "ibm128",		 RS6000_BTM_IBM128,     false, false },
   { "float128-hw",	 RS6000_BTM_FLOAT128_HW,false, false },
   { "mma",		 RS6000_BTM_MMA,	false, false },
   { "power10",		 RS6000_BTM_P10,	false, false },
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 164d359b724..b0e1953aeae 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -504,6 +504,12 @@ extern int rs6000_vector_align[];
 #define TARGET_MINMAX	(TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT		\
 			 && (TARGET_P9_MINMAX || !flag_trapping_math))
 
+/* Whether the '__ibm128' keywork is enabled.  We enable __ibm128 either if the
+   IEEE 128-bit floating point support is enabled or if the long double support
+   uses the 128-bit IBM extended double format.  */
+#define TARGET_IBM128	(TARGET_FLOAT128_TYPE				\
+			 || (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128))
+
 /* In switching from using target_flags to using rs6000_isa_flags, the options
    machinery creates OPTION_MASK_<xxx> instead of MASK_<xxx>.  For now map
    OPTION_MASK_<xxx> back into MASK_<xxx>.  */
@@ -2305,7 +2311,7 @@ extern int frame_pointer_needed;
 #define RS6000_BTC_SAT		RS6000_BTC_MISC	/* saturate sets VSCR.  */
 
 /* Builtin targets.  For now, we reuse the masks for those options that are in
-   target flags, and pick a random bit for ldbl128, which isn't in
+   target flags, and pick a random bit for ldbl128 and ibm128, which aren't in
    target_flags.  */
 #define RS6000_BTM_ALWAYS	0		/* Always enabled.  */
 #define RS6000_BTM_ALTIVEC	MASK_ALTIVEC	/* VMX/altivec vectors.  */
@@ -2327,7 +2333,7 @@ extern int frame_pointer_needed;
 #define RS6000_BTM_LDBL128	MASK_MULTIPLE	/* 128-bit long double.  */
 #define RS6000_BTM_64BIT	MASK_64BIT	/* 64-bit addressing.  */
 #define RS6000_BTM_POWERPC64	MASK_POWERPC64	/* 64-bit registers.  */
-#define RS6000_BTM_FLOAT128	MASK_FLOAT128_KEYWORD /* IEEE 128-bit float.  */
+#define RS6000_BTM_IBM128	MASK_FLOAT128_KEYWORD /* __ibm128 keyword.  */
 #define RS6000_BTM_FLOAT128_HW	MASK_FLOAT128_HW /* IEEE 128-bit float h/w.  */
 #define RS6000_BTM_MMA		MASK_MMA	/* ISA 3.1 MMA.  */
 #define RS6000_BTM_P10		MASK_POWER10
@@ -2351,7 +2357,7 @@ extern int frame_pointer_needed;
 				 | RS6000_BTM_HARD_FLOAT		\
 				 | RS6000_BTM_LDBL128			\
 				 | RS6000_BTM_POWERPC64			\
-				 | RS6000_BTM_FLOAT128			\
+				 | RS6000_BTM_IBM128			\
 				 | RS6000_BTM_FLOAT128_HW		\
 				 | RS6000_BTM_MMA			\
 				 | RS6000_BTM_P10)
diff --git a/libgcc/config/rs6000/ibm-ldouble.c b/libgcc/config/rs6000/ibm-ldouble.c
index 4c13453f975..92b4b4c583d 100644
--- a/libgcc/config/rs6000/ibm-ldouble.c
+++ b/libgcc/config/rs6000/ibm-ldouble.c
@@ -102,9 +102,9 @@ __asm__ (".symver __gcc_qadd,_xlqadd@GCC_3.4\n\t"
 static inline IBM128_TYPE
 pack_ldouble (double dh, double dl)
 {
-#if defined (__LONG_DOUBLE_128__) && defined (__LONG_DOUBLE_IBM128__)	\
+#if defined (__LONG_DOUBLE_128__)					\
     && !(defined (_SOFT_FLOAT) || defined (__NO_FPRS__))
-  return __builtin_pack_longdouble (dh, dl);
+  return __builtin_pack_ibm128 (dh, dl);
 #else
   union
   {
-- 
2.31.1

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797

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

* Re: [PATCH] Allow __ibm128 on older PowerPC systems.
  2021-05-18 20:36 [PATCH] Allow __ibm128 on older PowerPC systems Michael Meissner
@ 2021-05-20 19:29 ` will schmidt
  2021-05-21  1:49   ` Michael Meissner
  2021-05-24 15:53 ` Ping " Michael Meissner
  2021-06-01 23:43 ` Ping #2: " Michael Meissner
  2 siblings, 1 reply; 5+ messages in thread
From: will schmidt @ 2021-05-20 19:29 UTC (permalink / raw)
  To: Michael Meissner, gcc-patches, Segher Boessenkool,
	David Edelsohn, Bill Schmidt, Peter Bergner

On Tue, 2021-05-18 at 16:36 -0400, Michael Meissner wrote:
> [PATCH] Allow __ibm128 on older PowerPC systems.
> 

Hi,


> On January 8th, 2018, I added code to ibm-ldouble.c to use the built-in
> function __builtin_pack_ibm128 if long double is IEEE 128-bit and continue to
> use __builtin_pack_longdouble if long double is IBM extended double.  This code
> was needed because __builtin_pack_ibm128 is not available unless the __ibm128
> keyword is availabe.  In the current code, __ibm128 is only enabled if we have
> support for both IBM and IEEE 128-bit long double.

"available."

May be worth re-sifting the description to drop the history not
directly applicable to what this patch is doing.

> 
> Segher suggested that instead I should make __ibm128, __builtin_pack_ibm128,
> and __builtin_unpack_ibm128 available on older systems that don't support IEEE
> 128-bit floating point but does support the IBM extended double floating point.
> 
> This patch changes the code so that __ibm128 is now exported if either
> long double uses the IBM extended double format, or IEEE 128-bit floating
> point is available.
> 
> I changed the internal built-in types from float128 to ibm128, since the
> only built-in functions that use this are __builtin_pack_ibm128 and
> __builtin_unpack_ibm128, and the new name matches the function.
> 
> In addition, this patch changes the function within libgcc that handles
> IBM long double to use the __builtin_pack_ibm128 function.

ok

> 
> I have done bootstrap builds with this patch on the following 3 systems:
>     1)	power9 running LE Linux using --with-cpu=power9
>     2)	power8 running BE Linux using --with-cpu=power8, testing both
> 	32/64-bit.
>     3)	power10 prototype running LE Linux using --with-cpu=power10.
> 
> There were no regressions to the tests, and the new test added passed.  Can I
> check these patches into trunk branch for GCC 12?
> 
> At the moment, I'm not sure this should be backported to GCC 11.  But I can
> easily do the back port after a stabilizing period.
> 
> gcc/
> 2021-05-18  Michael Meissner  <meissner@linux.ibm.com>
> 
> 	* config/rs6000/rs6000-builtin.def (BU_IBM128_2): Rename
> 	RS6000_BTM_IBM128 from RS6000_BTM_FLOAT128.

> 	* config/rs6000/rs6000-call.c (rs6000_invalid_builtin): Update
> 	error message for __ibm128 built-in functions.
> 	(rs6000_init_builtins): Create the __ibm128 keyword on older
> 	systems where long double uses the IBM extended double format,
> 	even if they don't support IEEE 128-bit floating point.

Could drop 'older', ok.

> 	* config/rs6000/rs6000.c (rs6000_builtin_mask_calculate): Rename
> 	RS6000_BTM_IBM128 from RS6000_BTM_FLOAT128.
> 	(rs6000_builtin_mask_names): Rename RS6000_BTM_IBM128 from
> 	RS6000_BTM_FLOAT128.
> 	* config/rs6000/rs6000.h (TARGET_IBM128): New macro.
> 	(RS6000_BTM_IBM128): Rename from RS6000_BTM_FLOAT128.
> 	(RS6000_BTM_COMMON): Rename RS6000_BTM_IBM128 from
> 	RS6000_BTM_FLOAT128.
ok
> 
> libgcc/
> 2021-05-18  Michael Meissner  <meissner@linux.ibm.com>
> 
> 	* config/rs6000/ibm-ldouble.c (pack_ldouble): Use
> 	__builtin_pack_ibm128 instead of __builtin_pack_longdouble.
> ---
>  gcc/config/rs6000/rs6000-builtin.def |  5 ++---
>  gcc/config/rs6000/rs6000-call.c      | 14 ++++++++++----
>  gcc/config/rs6000/rs6000.c           |  4 ++--
>  gcc/config/rs6000/rs6000.h           | 12 +++++++++---
>  libgcc/config/rs6000/ibm-ldouble.c   |  4 ++--
>  5 files changed, 25 insertions(+), 14 deletions(-)
> 
> diff --git a/gcc/config/rs6000/rs6000-builtin.def b/gcc/config/rs6000/rs6000-builtin.def
> index 609bebdfd74..6d82ed224fb 100644
> --- a/gcc/config/rs6000/rs6000-builtin.def
> +++ b/gcc/config/rs6000/rs6000-builtin.def
> @@ -796,13 +796,12 @@
>  		     | RS6000_BTC_BINARY),				\
>  		    CODE_FOR_ ## ICODE)			/* ICODE */
> 
> -/* 128-bit __ibm128 floating point builtins (use -mfloat128 to indicate that
> -   __ibm128 is available).  */
> +/* 128-bit __ibm128 floating point builtins.  */
>  #define BU_IBM128_2(ENUM, NAME, ATTR, ICODE)				\
>    RS6000_BUILTIN_2 (MISC_BUILTIN_ ## ENUM,		/* ENUM */	\
>  		    "__builtin_" NAME,			/* NAME */	\
>  		    (RS6000_BTM_HARD_FLOAT		/* MASK */	\
> -		     | RS6000_BTM_FLOAT128),				\
> +		     | RS6000_BTM_IBM128),				\
>  		    (RS6000_BTC_ ## ATTR		/* ATTR */	\
>  		     | RS6000_BTC_BINARY),				\
>  		    CODE_FOR_ ## ICODE)			/* ICODE */
ok


> diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c
> index c4332a61862..7bdc4eeca5f 100644
> --- a/gcc/config/rs6000/rs6000-call.c
> +++ b/gcc/config/rs6000/rs6000-call.c
> @@ -11540,8 +11540,8 @@ rs6000_invalid_builtin (enum rs6000_builtins fncode)
>      error ("%qs requires the %qs option", name, "-mhard-float");
>    else if ((fnmask & RS6000_BTM_FLOAT128_HW) != 0)
>      error ("%qs requires ISA 3.0 IEEE 128-bit floating point", name);
> -  else if ((fnmask & RS6000_BTM_FLOAT128) != 0)
> -    error ("%qs requires the %qs option", name, "%<-mfloat128%>");
> +  else if ((fnmask & RS6000_BTM_IBM128) != 0)
> +    error ("%qs requires the IBM 128-bit floating point", name);
>    else if ((fnmask & (RS6000_BTM_POPCNTD | RS6000_BTM_POWERPC64))
>  	   == (RS6000_BTM_POPCNTD | RS6000_BTM_POWERPC64))
>      error ("%qs requires the %qs (or newer), and %qs or %qs options",
> @@ -13236,7 +13236,7 @@ rs6000_init_builtins (void)
>       For IEEE 128-bit floating point, always create the type __ieee128.  If the
>       user used -mfloat128, rs6000-c.c will create a define from __float128 to
>       __ieee128.  */
> -  if (TARGET_FLOAT128_TYPE)
> +  if (TARGET_IBM128)
>      {
>        if (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
>  	ibm128_float_type_node = long_double_type_node;
> @@ -13250,7 +13250,13 @@ rs6000_init_builtins (void)
> 
>        lang_hooks.types.register_builtin_type (ibm128_float_type_node,
>  					      "__ibm128");
> +    }
> +
> +  else
> +    ibm128_float_type_node = long_double_type_node;
> 
> +  if (TARGET_FLOAT128_TYPE)
> +    {
>        if (TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
>  	ieee128_float_type_node = long_double_type_node;
>        else
> @@ -13261,7 +13267,7 @@ rs6000_init_builtins (void)
>      }
> 
>    else
> -    ieee128_float_type_node = ibm128_float_type_node = long_double_type_node;
> +    ieee128_float_type_node = long_double_type_node;
> 
>    /* Vector pair and vector quad support.  */
>    if (TARGET_EXTRA_BUILTINS)

ok

> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index 44ae3adbe7a..86f53297cb9 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -3427,7 +3427,7 @@ rs6000_builtin_mask_calculate (void)
>  	  | ((TARGET_LONG_DOUBLE_128
>  	      && TARGET_HARD_FLOAT
>  	      && !TARGET_IEEEQUAD)	    ? RS6000_BTM_LDBL128   : 0)
> -	  | ((TARGET_FLOAT128_TYPE)	    ? RS6000_BTM_FLOAT128  : 0)
> +	  | ((TARGET_IBM128)		    ? RS6000_BTM_IBM128    : 0)
>  	  | ((TARGET_FLOAT128_HW)	    ? RS6000_BTM_FLOAT128_HW : 0)
>  	  | ((TARGET_MMA)		    ? RS6000_BTM_MMA	   : 0)
>  	  | ((TARGET_POWER10)               ? RS6000_BTM_P10       : 0));
> @@ -24164,7 +24164,7 @@ static struct rs6000_opt_mask const rs6000_builtin_mask_names[] =
>    { "hard-float",	 RS6000_BTM_HARD_FLOAT,	false, false },
>    { "long-double-128",	 RS6000_BTM_LDBL128,	false, false },
>    { "powerpc64",	 RS6000_BTM_POWERPC64,  false, false },
> -  { "float128",		 RS6000_BTM_FLOAT128,   false, false },
> +  { "ibm128",		 RS6000_BTM_IBM128,     false, false },
>    { "float128-hw",	 RS6000_BTM_FLOAT128_HW,false, false },
>    { "mma",		 RS6000_BTM_MMA,	false, false },
>    { "power10",		 RS6000_BTM_P10,	false, false },

ok

> diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
> index 164d359b724..b0e1953aeae 100644
> --- a/gcc/config/rs6000/rs6000.h
> +++ b/gcc/config/rs6000/rs6000.h
> @@ -504,6 +504,12 @@ extern int rs6000_vector_align[];
>  #define TARGET_MINMAX	(TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT		\
>  			 && (TARGET_P9_MINMAX || !flag_trapping_math))
> 
> +/* Whether the '__ibm128' keywork is enabled.  We enable __ibm128 either if the

'Whether...' reads a bit strange, but it looks mostly consistent with
other comments in rs6000.h.

> +   IEEE 128-bit floating point support is enabled or if the long double support
> +   uses the 128-bit IBM extended double format.  */


> +#define TARGET_IBM128	(TARGET_FLOAT128_TYPE				\
> +			 || (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128))
> +
>  /* In switching from using target_flags to using rs6000_isa_flags, the options
>     machinery creates OPTION_MASK_<xxx> instead of MASK_<xxx>.  For now map
>     OPTION_MASK_<xxx> back into MASK_<xxx>.  */
> @@ -2305,7 +2311,7 @@ extern int frame_pointer_needed;
>  #define RS6000_BTC_SAT		RS6000_BTC_MISC	/* saturate sets VSCR.  */
> 
>  /* Builtin targets.  For now, we reuse the masks for those options that are in
> -   target flags, and pick a random bit for ldbl128, which isn't in
> +   target flags, and pick a random bit for ldbl128 and ibm128, which aren't in
>     target_flags.  */
>  #define RS6000_BTM_ALWAYS	0		/* Always enabled.  */
>  #define RS6000_BTM_ALTIVEC	MASK_ALTIVEC	/* VMX/altivec vectors.  */
> @@ -2327,7 +2333,7 @@ extern int frame_pointer_needed;
>  #define RS6000_BTM_LDBL128	MASK_MULTIPLE	/* 128-bit long double.  */
>  #define RS6000_BTM_64BIT	MASK_64BIT	/* 64-bit addressing.  */
>  #define RS6000_BTM_POWERPC64	MASK_POWERPC64	/* 64-bit registers.  */
> -#define RS6000_BTM_FLOAT128	MASK_FLOAT128_KEYWORD /* IEEE 128-bit float.  */
> +#define RS6000_BTM_IBM128	MASK_FLOAT128_KEYWORD /* __ibm128 keyword.  */
>  #define RS6000_BTM_FLOAT128_HW	MASK_FLOAT128_HW /* IEEE 128-bit float h/w.  */
>  #define RS6000_BTM_MMA		MASK_MMA	/* ISA 3.1 MMA.  */
>  #define RS6000_BTM_P10		MASK_POWER10
> @@ -2351,7 +2357,7 @@ extern int frame_pointer_needed;
>  				 | RS6000_BTM_HARD_FLOAT		\
>  				 | RS6000_BTM_LDBL128			\
>  				 | RS6000_BTM_POWERPC64			\
> -				 | RS6000_BTM_FLOAT128			\
> +				 | RS6000_BTM_IBM128			\
>  				 | RS6000_BTM_FLOAT128_HW		\
>  				 | RS6000_BTM_MMA			\
>  				 | RS6000_BTM_P10)

ok

> diff --git a/libgcc/config/rs6000/ibm-ldouble.c b/libgcc/config/rs6000/ibm-ldouble.c
> index 4c13453f975..92b4b4c583d 100644
> --- a/libgcc/config/rs6000/ibm-ldouble.c
> +++ b/libgcc/config/rs6000/ibm-ldouble.c
> @@ -102,9 +102,9 @@ __asm__ (".symver __gcc_qadd,_xlqadd@GCC_3.4\n\t"
>  static inline IBM128_TYPE
>  pack_ldouble (double dh, double dl)
>  {
> -#if defined (__LONG_DOUBLE_128__) && defined (__LONG_DOUBLE_IBM128__)	\
> +#if defined (__LONG_DOUBLE_128__)					\
>      && !(defined (_SOFT_FLOAT) || defined (__NO_FPRS__))
> -  return __builtin_pack_longdouble (dh, dl);
> +  return __builtin_pack_ibm128 (dh, dl);
>  #else
>    union
>    {

ok


Thanks,
-Will

> -- 
> 2.31.1
> 


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

* Re: [PATCH] Allow __ibm128 on older PowerPC systems.
  2021-05-20 19:29 ` will schmidt
@ 2021-05-21  1:49   ` Michael Meissner
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2021-05-21  1:49 UTC (permalink / raw)
  To: will schmidt
  Cc: Michael Meissner, gcc-patches, Segher Boessenkool,
	David Edelsohn, Bill Schmidt, Peter Bergner

On Thu, May 20, 2021 at 02:29:02PM -0500, will schmidt wrote:
> On Tue, 2021-05-18 at 16:36 -0400, Michael Meissner wrote:
> > [PATCH] Allow __ibm128 on older PowerPC systems.
> > 
> 
> Hi,
> 
> 
> > On January 8th, 2018, I added code to ibm-ldouble.c to use the built-in
> > function __builtin_pack_ibm128 if long double is IEEE 128-bit and continue to
> > use __builtin_pack_longdouble if long double is IBM extended double.  This code
> > was needed because __builtin_pack_ibm128 is not available unless the __ibm128
> > keyword is availabe.  In the current code, __ibm128 is only enabled if we have
> > support for both IBM and IEEE 128-bit long double.
> 
> "available."
> 
> May be worth re-sifting the description to drop the history not
> directly applicable to what this patch is doing.

When I commit the patch, I try to eliminate the history section.  But for
active patches, I hope that it helps to state what is different from the
previous patches.

> > gcc/
> > 2021-05-18  Michael Meissner  <meissner@linux.ibm.com>
> > 
> > 	* config/rs6000/rs6000-builtin.def (BU_IBM128_2): Rename
> > 	RS6000_BTM_IBM128 from RS6000_BTM_FLOAT128.
> 
> > 	* config/rs6000/rs6000-call.c (rs6000_invalid_builtin): Update
> > 	error message for __ibm128 built-in functions.
> > 	(rs6000_init_builtins): Create the __ibm128 keyword on older
> > 	systems where long double uses the IBM extended double format,
> > 	even if they don't support IEEE 128-bit floating point.
> 
> Could drop 'older', ok.

Well yes, but the reality is all of the server systems that support VSX (and
hence IEEE 128-bit) are newer than the systems that don't (power6, power5,
etc.).

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797

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

* Ping [PATCH] Allow __ibm128 on older PowerPC systems.
  2021-05-18 20:36 [PATCH] Allow __ibm128 on older PowerPC systems Michael Meissner
  2021-05-20 19:29 ` will schmidt
@ 2021-05-24 15:53 ` Michael Meissner
  2021-06-01 23:43 ` Ping #2: " Michael Meissner
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2021-05-24 15:53 UTC (permalink / raw)
  To: Michael Meissner, gcc-patches, Segher Boessenkool,
	David Edelsohn, Bill Schmidt, Peter Bergner, Will Schmidt

Ping patch.  This is independent of the other patches.

| Date: Tue, 18 May 2021 16:36:32 -0400
| Subject: [PATCH] Allow __ibm128 on older PowerPC systems.
| Message-ID: <20210518203632.GA15521@ibm-toto.the-meissners.org>

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797

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

* Ping #2: [PATCH] Allow __ibm128 on older PowerPC systems.
  2021-05-18 20:36 [PATCH] Allow __ibm128 on older PowerPC systems Michael Meissner
  2021-05-20 19:29 ` will schmidt
  2021-05-24 15:53 ` Ping " Michael Meissner
@ 2021-06-01 23:43 ` Michael Meissner
  2 siblings, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2021-06-01 23:43 UTC (permalink / raw)
  To: Michael Meissner, gcc-patches, Segher Boessenkool,
	David Edelsohn, Bill Schmidt, Peter Bergner, Will Schmidt

Ping patch again:

Original patch (Allow __ibm128 on older PowerPC systems):

| Date: Tue, 18 May 2021 16:36:32 -0400
| Subject: [PATCH] Allow __ibm128 on older PowerPC systems.
| Message-ID: <20210518203632.GA15521@ibm-toto.the-meissners.org>
| https://gcc.gnu.org/pipermail/gcc-patches/2021-May/570679.html

-- 
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797

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

end of thread, other threads:[~2021-06-01 23:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 20:36 [PATCH] Allow __ibm128 on older PowerPC systems Michael Meissner
2021-05-20 19:29 ` will schmidt
2021-05-21  1:49   ` Michael Meissner
2021-05-24 15:53 ` Ping " Michael Meissner
2021-06-01 23:43 ` Ping #2: " Michael Meissner

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 read-only IMAP folder(s) and NNTP newsgroup(s).