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]

[patch] Make gcc work with Cray T3E type sizes


Hi,

on the Cray T3E, short is 32 bits and int is 64 bits. This patch fixes two
functions which don't work correctly there.

In signed_or_unsigned_type, we only handle types which correspond to a
native C type. On the T3E, there is no such type for HImode. This patch
adds checks for int?I_type_node, similar to signed_type and unsigned_type.

In target_negative, the definition of the union used for representing
64-bit doubles assumes that int is 32 bits. This patch fixes this.

Additionaly, it fixes a type error in push_reload which Cray CC chokes on.
In the recursive call, NULL_RTX is passed to a parameter of type rtx *.

Bootstrapped on sparc-sun-solaris2.7 (as far as it gets - it still fails
when building libstdc++, but this isn't related to this patch) with
http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01619.html.

Bye

Roman

2001-06-28  Roman Lechtchinsky  <rl@cs.tu-berlin.de>
	* c-common.c (signed_or_unsigned_type): Handle machine mode types
	which do not correspond to a C type.
	* fold-const.c (target_negative): Make it work with 64 bit ints.
	* reload.c (push_reload): Fix a type error in a call to push_reload.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.238
diff -c -3 -p -r1.238 c-common.c
*** c-common.c	2001/06/22 19:18:56	1.238
--- c-common.c	2001/06/28 10:30:06
*************** signed_or_unsigned_type (unsignedp, type
*** 2074,2079 ****
--- 2074,2092 ----
    if (TYPE_PRECISION (type) == TYPE_PRECISION (widest_integer_literal_type_node))
      return (unsignedp ? widest_unsigned_literal_type_node
  	    : widest_integer_literal_type_node);
+ #if HOST_BITS_PER_WIDE_INT >= 64
+   if (TYPE_PRECISION (type) == TYPE_PRECISION (intTI_type_node))
+     return unsignedp ? unsigned_intTI_type_node : intTI_type_node;
+ #endif
+   if (TYPE_PRECISION (type) == TYPE_PRECISION (intDI_type_node))
+     return unsignedp ? unsigned_intDI_type_node : intDI_type_node;
+   if (TYPE_PRECISION (type) == TYPE_PRECISION (intSI_type_node))
+     return unsignedp ? unsigned_intSI_type_node : intSI_type_node;
+   if (TYPE_PRECISION (type) == TYPE_PRECISION (intHI_type_node))
+     return unsignedp ? unsigned_intHI_type_node : intHI_type_node;
+   if (TYPE_PRECISION (type) == TYPE_PRECISION (intQI_type_node))
+     return unsignedp ? unsigned_intQI_type_node : intQI_type_node;
+ 
    return type;
  }
  
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.158
diff -c -3 -p -r1.158 fold-const.c
*** fold-const.c	2001/06/04 13:21:38	1.158
--- fold-const.c	2001/06/28 10:30:09
*************** target_negative (x)
*** 899,908 ****
        unsigned sign      :  1;
        unsigned exponent  : 11;
        unsigned mantissa1 : 20;
!       unsigned mantissa2;
      } little_endian;
      struct {
!       unsigned mantissa2;
        unsigned mantissa1 : 20;
        unsigned exponent  : 11;
        unsigned sign      :  1;
--- 899,908 ----
        unsigned sign      :  1;
        unsigned exponent  : 11;
        unsigned mantissa1 : 20;
!       unsigned mantissa2 : 32;
      } little_endian;
      struct {
!       unsigned mantissa2 : 32;
        unsigned mantissa1 : 20;
        unsigned exponent  : 11;
        unsigned sign      :  1;
Index: reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.147
diff -c -3 -p -r1.147 reload.c
*** reload.c	2001/06/04 01:58:24	1.147
--- reload.c	2001/06/28 10:30:12
*************** push_reload (in, out, inloc, outloc, cla
*** 1046,1052 ****
  	 order as the reloads.  Thus if the outer reload is also of type
  	 RELOAD_OTHER, we are guaranteed that this inner reload will be
  	 output before the outer reload.  */
!       push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), NULL_RTX,
  		   in_class, VOIDmode, VOIDmode, 0, 0, opnum, type);
        dont_remove_subreg = 1;
      }
--- 1046,1052 ----
  	 order as the reloads.  Thus if the outer reload is also of type
  	 RELOAD_OTHER, we are guaranteed that this inner reload will be
  	 output before the outer reload.  */
!       push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), (rtx *)0,
  		   in_class, VOIDmode, VOIDmode, 0, 0, opnum, type);
        dont_remove_subreg = 1;
      }


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