This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for PR target/19930 [pow(long double, int) on ia64]


> You've now got a mismatch between defined/undefined and true/false.
> You should probably use true/false instead of defined/undefined.

Ok, and while I was at it, I decided to treat LIBGCC2_HAS_DF_MODE
exactly like XF and TF by documenting it in tm.texi and setting it only
if it is not set initially.

Steve Ellcey
sje@cup.hp.com

2005-02-24  Steve Ellcey  <sje@cup.hp.com>

	PR target/19930
	* doc/tm.texi (LIBGCC2_LONG_DOUBLE_TYPE_SIZE): Document.
	(LIBGCC2_HAS_DF_MODE): New.
	(LIBGCC2_HAS_XF_MODE): New.
	(LIBGCC2_HAS_TF_MODE): New.
	* libgcc2.h (LIBGCC2_HAS_XF_MODE): New name for HAVE_XFMODE.
	(LIBGCC2_HAS_TF_MODE): New name for HAVE_TFMODE.
	* libgcc2.c (LIBGCC2_HAS_XF_MODE): New name for HAVE_XFMODE.
	(LIBGCC2_HAS_TF_MODE): New name for HAVE_TFMODE.
	(LIBGCC2_HAS_DF_MODE): New name for HAVE_DFMODE.
	* config/ia64/t-ia64 (LIB1ASMFUNCS): Remove __compat
	and add _fixtfdi, _fixunstfdi, _floatditf
	* lib1funcs.asm: Remove L__compat. Add L_fixtfdi,
	L_fixunstfdi, L_floatditf.
	* config/ia64/hpux.h (LIBGCC2_HAS_XF_MODE): Define.
	(LIBGCC2_HAS_TF_MODE): Define.



*** gcc.orig/gcc/doc/tm.texi	Thu Feb 24 16:03:33 2005
--- gcc/gcc/doc/tm.texi	Thu Feb 24 16:03:33 2005
*************** the target machine.  If you don't define
*** 1635,1640 ****
--- 1635,1670 ----
  words.
  @end defmac
  
+ @defmac LIBGCC2_LONG_DOUBLE_TYPE_SIZE
+ Define this macro if @code{LONG_DOUBLE_TYPE_SIZE} is not constant or
+ if you want routines in @file{libgcc2.a} for a size other than
+ @code{LONG_DOUBLE_TYPE_SIZE}.  If you don't define this, the
+ default is @code{LONG_DOUBLE_TYPE_SIZE}.
+ @end defmac
+ 
+ @defmac LIBGCC2_HAS_DF_MODE
+ Define this macro if neither @code{LIBGCC2_DOUBLE_TYPE_SIZE} nor 
+ @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is
+ @code{DFmode} but you want @code{DFmode} routines in @file{libgcc2.a}
+ anyway.  If you don't define this and either @code{LIBGCC2_DOUBLE_TYPE_SIZE}
+ or @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is 64 then the default is 1,
+ otherwise it is 0.
+ @end defmac
+ 
+ @defmac LIBGCC2_HAS_XF_MODE
+ Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not 
+ @code{XFmode} but you want @code{XFmode} routines in @file{libgcc2.a}
+ anyway.  If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE}
+ is 80 then the default is 1, otherwise it is 0.
+ @end defmac
+ 
+ @defmac LIBGCC2_HAS_TF_MODE
+ Define this macro if @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE} is not 
+ @code{TFmode} but you want @code{TFmode} routines in @file{libgcc2.a}
+ anyway.  If you don't define this and @code{LIBGCC2_LONG_DOUBLE_TYPE_SIZE}
+ is 128 then the default is 1, otherwise it is 0.
+ @end defmac
+ 
  @defmac TARGET_FLT_EVAL_METHOD
  A C expression for the value for @code{FLT_EVAL_METHOD} in @file{float.h},
  assuming, if applicable, that the floating-point control word is in its
*** gcc.orig/gcc/libgcc2.h	Thu Feb 24 16:03:33 2005
--- gcc/gcc/libgcc2.h	Thu Feb 24 16:03:33 2005
*************** extern short int __get_eh_table_version 
*** 58,63 ****
--- 58,76 ----
  #define LIBGCC2_LONG_DOUBLE_TYPE_SIZE LONG_DOUBLE_TYPE_SIZE
  #endif
  
+ #ifndef LIBGCC2_HAS_DF_MODE
+ #define LIBGCC2_HAS_DF_MODE \
+   (LIBGCC2_DOUBLE_TYPE_SIZE == 64 || LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64)
+ #endif
+ 
+ #ifndef LIBGCC2_HAS_XF_MODE
+ #define LIBGCC2_HAS_XF_MODE (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80)
+ #endif
+ 
+ #ifndef LIBGCC2_HAS_TF_MODE
+ #define LIBGCC2_HAS_TF_MODE (LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128)
+ #endif
+ 
  #ifndef MIN_UNITS_PER_WORD
  #define MIN_UNITS_PER_WORD UNITS_PER_WORD
  #endif
*************** typedef unsigned int UTItype	__attribute
*** 96,113 ****
  typedef 	float SFtype	__attribute__ ((mode (SF)));
  typedef _Complex float SCtype	__attribute__ ((mode (SC)));
  
! #if LIBGCC2_DOUBLE_TYPE_SIZE == 64 || LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 64
! #define HAVE_DFMODE
  typedef		float DFtype	__attribute__ ((mode (DF)));
  typedef _Complex float DCtype	__attribute__ ((mode (DC)));
  #endif
! #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 80
! #define HAVE_XFMODE
  typedef		float XFtype	__attribute__ ((mode (XF)));
  typedef _Complex float XCtype	__attribute__ ((mode (XC)));
  #endif
! #if LIBGCC2_LONG_DOUBLE_TYPE_SIZE == 128
! #define HAVE_TFMODE
  typedef		float TFtype	__attribute__ ((mode (TF)));
  typedef _Complex float TCtype	__attribute__ ((mode (TC)));
  #endif
--- 109,123 ----
  typedef 	float SFtype	__attribute__ ((mode (SF)));
  typedef _Complex float SCtype	__attribute__ ((mode (SC)));
  
! #if LIBGCC2_HAS_DF_MODE
  typedef		float DFtype	__attribute__ ((mode (DF)));
  typedef _Complex float DCtype	__attribute__ ((mode (DC)));
  #endif
! #if LIBGCC2_HAS_XF_MODE
  typedef		float XFtype	__attribute__ ((mode (XF)));
  typedef _Complex float XCtype	__attribute__ ((mode (XC)));
  #endif
! #if LIBGCC2_HAS_TF_MODE
  typedef		float TFtype	__attribute__ ((mode (TF)));
  typedef _Complex float TCtype	__attribute__ ((mode (TC)));
  #endif
*************** extern SFtype __powisf2 (SFtype, Wtype);
*** 329,335 ****
  extern SCtype __divsc3 (SFtype, SFtype, SFtype, SFtype);
  extern SCtype __mulsc3 (SFtype, SFtype, SFtype, SFtype);
  
! #ifdef HAVE_DFMODE
  extern DWtype __fixdfdi (DFtype);
  extern DFtype __floatdidf (DWtype);
  extern UWtype __fixunsdfSI (DFtype);
--- 339,345 ----
  extern SCtype __divsc3 (SFtype, SFtype, SFtype, SFtype);
  extern SCtype __mulsc3 (SFtype, SFtype, SFtype, SFtype);
  
! #if LIBGCC2_HAS_DF_MODE
  extern DWtype __fixdfdi (DFtype);
  extern DFtype __floatdidf (DWtype);
  extern UWtype __fixunsdfSI (DFtype);
*************** extern DCtype __divdc3 (DFtype, DFtype, 
*** 339,345 ****
  extern DCtype __muldc3 (DFtype, DFtype, DFtype, DFtype);
  #endif
  
! #ifdef HAVE_XFMODE
  extern DWtype __fixxfdi (XFtype);
  extern DWtype __fixunsxfDI (XFtype);
  extern XFtype __floatdixf (DWtype);
--- 349,355 ----
  extern DCtype __muldc3 (DFtype, DFtype, DFtype, DFtype);
  #endif
  
! #if LIBGCC2_HAS_XF_MODE
  extern DWtype __fixxfdi (XFtype);
  extern DWtype __fixunsxfDI (XFtype);
  extern XFtype __floatdixf (DWtype);
*************** extern XCtype __divxc3 (XFtype, XFtype, 
*** 349,355 ****
  extern XCtype __mulxc3 (XFtype, XFtype, XFtype, XFtype);
  #endif
  
! #ifdef HAVE_TFMODE
  extern DWtype __fixunstfDI (TFtype);
  extern DWtype __fixtfdi (TFtype);
  extern TFtype __floatditf (DWtype);
--- 359,365 ----
  extern XCtype __mulxc3 (XFtype, XFtype, XFtype, XFtype);
  #endif
  
! #if LIBGCC2_HAS_TF_MODE
  extern DWtype __fixunstfDI (TFtype);
  extern DWtype __fixtfdi (TFtype);
  extern TFtype __floatditf (DWtype);
*** gcc.orig/gcc/libgcc2.c	Thu Feb 24 16:03:33 2005
--- gcc/gcc/libgcc2.c	Thu Feb 24 16:03:33 2005
*************** __ucmpdi2 (DWtype a, DWtype b)
*** 1155,1161 ****
  }
  #endif
  
! #if defined(L_fixunstfdi) && defined(HAVE_TFMODE)
  DWtype
  __fixunstfDI (TFtype a)
  {
--- 1155,1161 ----
  }
  #endif
  
! #if defined(L_fixunstfdi) && LIBGCC2_HAS_TF_MODE
  DWtype
  __fixunstfDI (TFtype a)
  {
*************** __fixunstfDI (TFtype a)
*** 1181,1187 ****
  }
  #endif
  
! #if defined(L_fixtfdi) && defined(HAVE_TFMODE)
  DWtype
  __fixtfdi (TFtype a)
  {
--- 1181,1187 ----
  }
  #endif
  
! #if defined(L_fixtfdi) && LIBGCC2_HAS_TF_MODE
  DWtype
  __fixtfdi (TFtype a)
  {
*************** __fixtfdi (TFtype a)
*** 1191,1197 ****
  }
  #endif
  
! #if defined(L_fixunsxfdi) && defined(HAVE_XFMODE)
  DWtype
  __fixunsxfDI (XFtype a)
  {
--- 1191,1197 ----
  }
  #endif
  
! #if defined(L_fixunsxfdi) && LIBGCC2_HAS_XF_MODE
  DWtype
  __fixunsxfDI (XFtype a)
  {
*************** __fixunsxfDI (XFtype a)
*** 1217,1223 ****
  }
  #endif
  
! #if defined(L_fixxfdi) && defined(HAVE_XFMODE)
  DWtype
  __fixxfdi (XFtype a)
  {
--- 1217,1223 ----
  }
  #endif
  
! #if defined(L_fixxfdi) && LIBGCC2_HAS_XF_MODE
  DWtype
  __fixxfdi (XFtype a)
  {
*************** __fixxfdi (XFtype a)
*** 1227,1233 ****
  }
  #endif
  
! #if defined(L_fixunsdfdi) && defined(HAVE_DFMODE)
  DWtype
  __fixunsdfDI (DFtype a)
  {
--- 1227,1233 ----
  }
  #endif
  
! #if defined(L_fixunsdfdi) && LIBGCC2_HAS_DF_MODE
  DWtype
  __fixunsdfDI (DFtype a)
  {
*************** __fixunsdfDI (DFtype a)
*** 1246,1252 ****
  }
  #endif
  
! #if defined(L_fixdfdi) && defined(HAVE_DFMODE)
  DWtype
  __fixdfdi (DFtype a)
  {
--- 1246,1252 ----
  }
  #endif
  
! #if defined(L_fixdfdi) && LIBGCC2_HAS_DF_MODE
  DWtype
  __fixdfdi (DFtype a)
  {
*************** __fixdfdi (DFtype a)
*** 1260,1266 ****
  DWtype
  __fixunssfDI (SFtype a)
  {
! #if defined(HAVE_DFMODE)
    /* Convert the SFtype to a DFtype, because that is surely not going
       to lose any bits.  Some day someone else can write a faster version
       that avoids converting to DFtype, and verify it really works right.  */
--- 1260,1266 ----
  DWtype
  __fixunssfDI (SFtype a)
  {
! #if LIBGCC2_HAS_DF_MODE
    /* Convert the SFtype to a DFtype, because that is surely not going
       to lose any bits.  Some day someone else can write a faster version
       that avoids converting to DFtype, and verify it really works right.  */
*************** __fixsfdi (SFtype a)
*** 1330,1336 ****
  }
  #endif
  
! #if defined(L_floatdixf) && defined(HAVE_XFMODE)
  XFtype
  __floatdixf (DWtype u)
  {
--- 1330,1336 ----
  }
  #endif
  
! #if defined(L_floatdixf) && LIBGCC2_HAS_XF_MODE
  XFtype
  __floatdixf (DWtype u)
  {
*************** __floatdixf (DWtype u)
*** 1341,1347 ****
  }
  #endif
  
! #if defined(L_floatditf) && defined(HAVE_TFMODE)
  TFtype
  __floatditf (DWtype u)
  {
--- 1341,1347 ----
  }
  #endif
  
! #if defined(L_floatditf) && LIBGCC2_HAS_TF_MODE
  TFtype
  __floatditf (DWtype u)
  {
*************** __floatditf (DWtype u)
*** 1352,1358 ****
  }
  #endif
  
! #if defined(L_floatdidf) && defined(HAVE_DFMODE)
  DFtype
  __floatdidf (DWtype u)
  {
--- 1352,1358 ----
  }
  #endif
  
! #if defined(L_floatdidf) && LIBGCC2_HAS_DF_MODE
  DFtype
  __floatdidf (DWtype u)
  {
*************** __floatdisf (DWtype u)
*** 1376,1382 ****
    f *= Wtype_MAXp1_F;
    f += (UWtype)u;
    return f;
! #elif defined(HAVE_DFMODE)
  
  #if LIBGCC2_DOUBLE_TYPE_SIZE == 64
  #define DF_SIZE DBL_MANT_DIG
--- 1376,1382 ----
    f *= Wtype_MAXp1_F;
    f += (UWtype)u;
    return f;
! #elif LIBGCC2_HAS_DF_MODE
  
  #if LIBGCC2_DOUBLE_TYPE_SIZE == 64
  #define DF_SIZE DBL_MANT_DIG
*************** __floatdisf (DWtype u)
*** 1451,1457 ****
  }
  #endif
  
! #if defined(L_fixunsxfsi) && defined(HAVE_XFMODE)
  /* Reenable the normal types, in case limits.h needs them.  */
  #undef char
  #undef short
--- 1451,1457 ----
  }
  #endif
  
! #if defined(L_fixunsxfsi) && LIBGCC2_HAS_XF_MODE
  /* Reenable the normal types, in case limits.h needs them.  */
  #undef char
  #undef short
*************** __fixunsxfSI (XFtype a)
*** 1473,1479 ****
  }
  #endif
  
! #if defined(L_fixunsdfsi) && defined(HAVE_DFMODE)
  /* Reenable the normal types, in case limits.h needs them.  */
  #undef char
  #undef short
--- 1473,1479 ----
  }
  #endif
  
! #if defined(L_fixunsdfsi) && LIBGCC2_HAS_DF_MODE
  /* Reenable the normal types, in case limits.h needs them.  */
  #undef char
  #undef short
*************** __fixunssfSI (SFtype a)
*** 1521,1529 ****
     exponents.  */
  
  #if defined(L_powisf2) \
!     || (defined(L_powidf2) && defined(HAVE_DFMODE)) \
!     || (defined(L_powixf2) && defined(HAVE_XFMODE)) \
!     || (defined(L_powitf2) && defined(HAVE_TFMODE))
  # if defined(L_powisf2)
  #  define TYPE SFtype
  #  define NAME __powisf2
--- 1521,1529 ----
     exponents.  */
  
  #if defined(L_powisf2) \
!     || (defined(L_powidf2) && LIBGCC2_HAS_DF_MODE) \
!     || (defined(L_powixf2) && LIBGCC2_HAS_XF_MODE) \
!     || (defined(L_powitf2) && LIBGCC2_HAS_TF_MODE)
  # if defined(L_powisf2)
  #  define TYPE SFtype
  #  define NAME __powisf2
*************** NAME (TYPE x, Wtype m)
*** 1555,1563 ****
  #endif
  
  #if defined(L_mulsc3) || defined(L_divsc3) \
!     || ((defined(L_muldc3) || defined(L_divdc3)) && defined(HAVE_DFMODE)) \
!     || ((defined(L_mulxc3) || defined(L_divxc3)) && defined(HAVE_XFMODE)) \
!     || ((defined(L_multc3) || defined(L_divtc3)) && defined(HAVE_TFMODE))
  
  #undef float
  #undef double
--- 1555,1563 ----
  #endif
  
  #if defined(L_mulsc3) || defined(L_divsc3) \
!     || ((defined(L_muldc3) || defined(L_divdc3)) && LIBGCC2_HAS_DF_MODE) \
!     || ((defined(L_mulxc3) || defined(L_divxc3)) && LIBGCC2_HAS_XF_MODE) \
!     || ((defined(L_multc3) || defined(L_divtc3)) && LIBGCC2_HAS_TF_MODE)
  
  #undef float
  #undef double
*** gcc.orig/gcc/config/ia64/t-ia64	Thu Feb 24 16:03:33 2005
--- gcc/gcc/config/ia64/t-ia64	Thu Feb 24 16:03:33 2005
*************** LIB1ASMSRC    = ia64/lib1funcs.asm
*** 8,14 ****
  LIB1ASMFUNCS  = __divxf3 __divdf3 __divsf3 \
  	__divdi3 __moddi3 __udivdi3 __umoddi3 \
  	__divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
! 	__nonlocal_goto __restore_stack_nonlocal __trampoline __compat
  
  # ??? Hack to get -P option used when compiling lib1funcs.asm, because Intel
  # assembler does not accept # line number as a comment.
--- 8,15 ----
  LIB1ASMFUNCS  = __divxf3 __divdf3 __divsf3 \
  	__divdi3 __moddi3 __udivdi3 __umoddi3 \
  	__divsi3 __modsi3 __udivsi3 __umodsi3 __save_stack_nonlocal \
! 	__nonlocal_goto __restore_stack_nonlocal __trampoline \
! 	_fixtfdi _fixunstfdi _floatditf
  
  # ??? Hack to get -P option used when compiling lib1funcs.asm, because Intel
  # assembler does not accept # line number as a comment.
*** gcc.orig/gcc/config/ia64/lib1funcs.asm	Thu Feb 24 16:03:34 2005
--- gcc/gcc/config/ia64/lib1funcs.asm	Thu Feb 24 16:03:34 2005
*************** __ia64_trampoline:
*** 706,714 ****
  	.endp __ia64_trampoline
  #endif
  
- #ifdef L__compat
  // Thunks for backward compatibility.
! 
  	.text
  	.align 16
  	.global __fixtfti
--- 706,713 ----
  	.endp __ia64_trampoline
  #endif
  
  // Thunks for backward compatibility.
! #ifdef L_fixtfdi
  	.text
  	.align 16
  	.global __fixtfti
*************** __fixtfti:
*** 719,725 ****
  	  ;;
  	}
  	.endp __fixtfti
! 
  	.align 16
  	.global __fixunstfti
  	.proc __fixunstfti
--- 718,725 ----
  	  ;;
  	}
  	.endp __fixtfti
! #endif
! #ifdef L_fixunstfdi
  	.align 16
  	.global __fixunstfti
  	.proc __fixunstfti
*************** __fixunstfti:
*** 729,735 ****
  	  ;;
  	}
  	.endp __fixunstfti
! 
  	.align 16
  	.global __floattitf
  	.proc __floattitf
--- 729,736 ----
  	  ;;
  	}
  	.endp __fixunstfti
! #endif
! #if L_floatditf
  	.align 16
  	.global __floattitf
  	.proc __floattitf
*************** __floattitf:
*** 739,743 ****
  	  ;;
  	}
  	.endp __floattitf
- 
  #endif
--- 740,743 ----
*** gcc.orig/gcc/config/ia64/hpux.h	Thu Feb 24 16:03:34 2005
--- gcc/gcc/config/ia64/hpux.h	Thu Feb 24 16:03:34 2005
*************** do {								\
*** 202,204 ****
--- 202,212 ----
  #define TARGET_INIT_LIBFUNCS ia64_hpux_init_libfuncs
  
  #define FLOAT_LIB_COMPARE_RETURNS_BOOL(MODE, COMPARISON) ((MODE) == TFmode)
+ 
+ /* Put all *xf routines in libgcc, regardless of long double size.  */
+ #undef LIBGCC2_HAS_XF_MODE
+ #define LIBGCC2_HAS_XF_MODE 1
+ 
+ /* Put all *tf routines in libgcc, regardless of long double size.  */
+ #undef LIBGCC2_HAS_TF_MODE
+ #define LIBGCC2_HAS_TF_MODE 1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]