diff mbox

[AArch64,4/6] soft-fp: Commonize creation of TImode types

Message ID 1389204801-9832-5-git-send-email-rth@redhat.com
State New
Headers show

Commit Message

Richard Henderson Jan. 8, 2014, 6:13 p.m. UTC
No need to do this over and over for different 64-bit hosts.

libgcc/
	* config/soft-fp/soft-fp.h (TItype, UTItype, TI_BITS): New.
	* config/aarch64/sfp-machine.h (TItype, UTItype, TI_BITS): Remove.
	* config/i386/64/sfp-machine.h: Likewise.
	* config/ia64/sfp-machine.h: Likewise.
	* config/tilegx/sfp-machine32.h: Likewise.
	* config/tilegx/sfp-machine64.h: Likewise.
---
 libgcc/config/aarch64/sfp-machine.h  | 4 ----
 libgcc/config/i386/64/sfp-machine.h  | 5 -----
 libgcc/config/ia64/sfp-machine.h     | 5 -----
 libgcc/config/tilegx/sfp-machine32.h | 5 -----
 libgcc/config/tilegx/sfp-machine64.h | 5 -----
 libgcc/soft-fp/soft-fp.h             | 8 ++++++++
 6 files changed, 8 insertions(+), 24 deletions(-)

Comments

Joseph Myers Jan. 8, 2014, 8:39 p.m. UTC | #1
On Wed, 8 Jan 2014, Richard Henderson wrote:

> diff --git a/libgcc/soft-fp/soft-fp.h b/libgcc/soft-fp/soft-fp.h
> index 696fc86..b54b1ed 100644
> --- a/libgcc/soft-fp/soft-fp.h
> +++ b/libgcc/soft-fp/soft-fp.h
> @@ -237,6 +237,11 @@ typedef int DItype __attribute__ ((mode (DI)));
>  typedef unsigned int UQItype __attribute__ ((mode (QI)));
>  typedef unsigned int USItype __attribute__ ((mode (SI)));
>  typedef unsigned int UDItype __attribute__ ((mode (DI)));
> +#if _FP_W_TYPE_SIZE == 64
> +typedef int TItype __attribute__ ((mode (TI)));
> +typedef unsigned int UTItype __attribute__ ((mode (TI)));
> +#endif

This isn't the right conditional.  _FP_W_TYPE_SIZE is ultimately an 
optimization choice and need not be related to whether any TImode 
functions are being defined using soft-fp, or whether TImode is supported 
at all.  I think the most you can do is have sfp-machine.h define a macro 
to say that TImode should be supported in soft-fp, rather than actually 
defining the types itself.

(If someone were to use soft-fp on hppa64, then they might well use 
_FP_W_TYPE_SIZE == 64, but hppa64 doesn't support TImode.)
Richard Henderson Jan. 9, 2014, 3:57 p.m. UTC | #2
On 01/08/2014 12:39 PM, Joseph S. Myers wrote:
> On Wed, 8 Jan 2014, Richard Henderson wrote:
> 
>> diff --git a/libgcc/soft-fp/soft-fp.h b/libgcc/soft-fp/soft-fp.h
>> index 696fc86..b54b1ed 100644
>> --- a/libgcc/soft-fp/soft-fp.h
>> +++ b/libgcc/soft-fp/soft-fp.h
>> @@ -237,6 +237,11 @@ typedef int DItype __attribute__ ((mode (DI)));
>>  typedef unsigned int UQItype __attribute__ ((mode (QI)));
>>  typedef unsigned int USItype __attribute__ ((mode (SI)));
>>  typedef unsigned int UDItype __attribute__ ((mode (DI)));
>> +#if _FP_W_TYPE_SIZE == 64
>> +typedef int TItype __attribute__ ((mode (TI)));
>> +typedef unsigned int UTItype __attribute__ ((mode (TI)));
>> +#endif
> 
> This isn't the right conditional.  _FP_W_TYPE_SIZE is ultimately an 
> optimization choice and need not be related to whether any TImode 
> functions are being defined using soft-fp, or whether TImode is supported 
> at all.  I think the most you can do is have sfp-machine.h define a macro 
> to say that TImode should be supported in soft-fp, rather than actually 
> defining the types itself.

The documentation for longlong.h say we must have a double-word type defined.
Given how easy it is to support a double-word type...

> 
> (If someone were to use soft-fp on hppa64, then they might well use 
> _FP_W_TYPE_SIZE == 64, but hppa64 doesn't support TImode.)
> 

... I can't imagine that this is anything but a bug.  Not that anyone seems to
be doing any hppa work at all these past years.


r~
Joseph Myers Jan. 9, 2014, 6:37 p.m. UTC | #3
On Thu, 9 Jan 2014, Richard Henderson wrote:

> > This isn't the right conditional.  _FP_W_TYPE_SIZE is ultimately an 
> > optimization choice and need not be related to whether any TImode 
> > functions are being defined using soft-fp, or whether TImode is supported 
> > at all.  I think the most you can do is have sfp-machine.h define a macro 
> > to say that TImode should be supported in soft-fp, rather than actually 
> > defining the types itself.
> 
> The documentation for longlong.h say we must have a double-word type defined.
> Given how easy it is to support a double-word type...

I suppose that's a reason to define TImode types under that condition 
unless and until soft-fp is used with _FP_W_TYPE_SIZE == 64 for an 
architecture not supporting them (there's also the possibility it might be 
used with _FP_W_TYPE_SIZE == 32 but with TImode support wanted, though 
defining the types in sfp-machine.h would of course be possible then).  
But of course the patches need proposing for glibc first (for longlong.h 
things are less clear, as long as a patch applied to one place is promptly 
then applied to the other).
diff mbox

Patch

diff --git a/libgcc/config/aarch64/sfp-machine.h b/libgcc/config/aarch64/sfp-machine.h
index 61b5f72..5e676be 100644
--- a/libgcc/config/aarch64/sfp-machine.h
+++ b/libgcc/config/aarch64/sfp-machine.h
@@ -28,10 +28,6 @@  see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
 #define _FP_WS_TYPE		signed long long
 #define _FP_I_TYPE		int
 
-typedef int TItype __attribute__ ((mode (TI)));
-typedef unsigned int UTItype __attribute__ ((mode (TI)));
-#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
-
 /* The type of the result of a floating point comparison.  This must
    match __libgcc_cmp_return__ in GCC for the target.  */
 typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
diff --git a/libgcc/config/i386/64/sfp-machine.h b/libgcc/config/i386/64/sfp-machine.h
index 1ff94c2..8197536 100644
--- a/libgcc/config/i386/64/sfp-machine.h
+++ b/libgcc/config/i386/64/sfp-machine.h
@@ -3,11 +3,6 @@ 
 #define _FP_WS_TYPE		signed long long
 #define _FP_I_TYPE		long long
 
-typedef int TItype __attribute__ ((mode (TI)));
-typedef unsigned int UTItype __attribute__ ((mode (TI)));
-
-#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
-
 #define _FP_MUL_MEAT_Q(R,X,Y)				\
   _FP_MUL_MEAT_2_wide(_FP_WFRACBITS_Q,R,X,Y,umul_ppmm)
 
diff --git a/libgcc/config/ia64/sfp-machine.h b/libgcc/config/ia64/sfp-machine.h
index e06bc9a..f7dd928 100644
--- a/libgcc/config/ia64/sfp-machine.h
+++ b/libgcc/config/ia64/sfp-machine.h
@@ -3,11 +3,6 @@ 
 #define _FP_WS_TYPE		signed long
 #define _FP_I_TYPE		long
 
-typedef int TItype __attribute__ ((mode (TI)));
-typedef unsigned int UTItype __attribute__ ((mode (TI)));
-
-#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
-
 /* The type of the result of a floating point comparison.  This must
    match `__libgcc_cmp_return__' in GCC for the target.  */
 typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
diff --git a/libgcc/config/tilegx/sfp-machine32.h b/libgcc/config/tilegx/sfp-machine32.h
index 31a2032..a921533 100644
--- a/libgcc/config/tilegx/sfp-machine32.h
+++ b/libgcc/config/tilegx/sfp-machine32.h
@@ -3,11 +3,6 @@ 
 #define _FP_WS_TYPE		signed long
 #define _FP_I_TYPE		long
 
-typedef int TItype __attribute__ ((mode (TI)));
-typedef unsigned int UTItype __attribute__ ((mode (TI)));
-
-#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
-
 /* The type of the result of a floating point comparison.  This must
    match `__libgcc_cmp_return__' in GCC for the target.  */
 typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
diff --git a/libgcc/config/tilegx/sfp-machine64.h b/libgcc/config/tilegx/sfp-machine64.h
index 7cf352e..2586dd5 100644
--- a/libgcc/config/tilegx/sfp-machine64.h
+++ b/libgcc/config/tilegx/sfp-machine64.h
@@ -3,11 +3,6 @@ 
 #define _FP_WS_TYPE		signed long
 #define _FP_I_TYPE		long
 
-typedef int TItype __attribute__ ((mode (TI)));
-typedef unsigned int UTItype __attribute__ ((mode (TI)));
-
-#define TI_BITS (__CHAR_BIT__ * (int)sizeof(TItype))
-
 /* The type of the result of a floating point comparison.  This must
    match `__libgcc_cmp_return__' in GCC for the target.  */
 typedef int __gcc_CMPtype __attribute__ ((mode (__libgcc_cmp_return__)));
diff --git a/libgcc/soft-fp/soft-fp.h b/libgcc/soft-fp/soft-fp.h
index 696fc86..b54b1ed 100644
--- a/libgcc/soft-fp/soft-fp.h
+++ b/libgcc/soft-fp/soft-fp.h
@@ -237,6 +237,11 @@  typedef int DItype __attribute__ ((mode (DI)));
 typedef unsigned int UQItype __attribute__ ((mode (QI)));
 typedef unsigned int USItype __attribute__ ((mode (SI)));
 typedef unsigned int UDItype __attribute__ ((mode (DI)));
+#if _FP_W_TYPE_SIZE == 64
+typedef int TItype __attribute__ ((mode (TI)));
+typedef unsigned int UTItype __attribute__ ((mode (TI)));
+#endif
+
 #if _FP_W_TYPE_SIZE == 32
 typedef unsigned int UHWtype __attribute__ ((mode (HI)));
 #elif _FP_W_TYPE_SIZE == 64
@@ -249,6 +254,9 @@  typedef USItype UHWtype;
 
 #define SI_BITS		(__CHAR_BIT__ * (int) sizeof (SItype))
 #define DI_BITS		(__CHAR_BIT__ * (int) sizeof (DItype))
+#if _FP_W_TYPE_SIZE == 64
+# define TI_BITS	(__CHAR_BIT__ * (int) sizeof (TItype))
+#endif
 
 #ifndef umul_ppmm
 # ifdef _LIBC