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] Promote xImode types to int


Hi,

this patch ensures that types defined with __attribute((mode(xI))) which
are smaller than an int get promoted to int if necessary even if there is
no corresponding native C type. It checks for each xImode type
individually; I'm not sure if just checking whether an INTEGER_TYPE is
smaller than an int is sufficient here. Should that be the case I'll
simplify and resubmit the patch.

Bootstrapped and regtested on sparc-sun-solaris2.8.

Bye

Roman

2001-09-14  Roman Lechtchinsky  <rl@cs.tu-berlin.de>

	* c-common.c (c_promoting_integer_type_p): Handle ?Imode types.

Index: c-common.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.c,v
retrieving revision 1.250
diff -c -3 -p -r1.250 c-common.c
*** c-common.c	2001/09/12 17:17:48	1.250
--- c-common.c	2001/09/14 19:30:55
*************** c_promoting_integer_type_p (t)
*** 3391,3397 ****
  	      || TYPE_MAIN_VARIANT (t) == signed_char_type_node
  	      || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node
  	      || TYPE_MAIN_VARIANT (t) == short_integer_type_node
! 	      || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node);
  
      case ENUMERAL_TYPE:
        /* ??? Technically all enumerations not larger than an int
--- 3391,3406 ----
  	      || TYPE_MAIN_VARIANT (t) == signed_char_type_node
  	      || TYPE_MAIN_VARIANT (t) == unsigned_char_type_node
  	      || TYPE_MAIN_VARIANT (t) == short_integer_type_node
! 	      || TYPE_MAIN_VARIANT (t) == short_unsigned_type_node
! 	      || ((TYPE_MAIN_VARIANT (t) == intQI_type_node
! 		   || TYPE_MAIN_VARIANT (t) == unsigned_intQI_type_node
! 		   || TYPE_MAIN_VARIANT (t) == intHI_type_node
! 		   || TYPE_MAIN_VARIANT (t) == unsigned_intHI_type_node
! 		   || TYPE_MAIN_VARIANT (t) == intSI_type_node
! 		   || TYPE_MAIN_VARIANT (t) == unsigned_intSI_type_node
! 		   || TYPE_MAIN_VARIANT (t) == intDI_type_node
! 		   || TYPE_MAIN_VARIANT (t) == unsigned_intDI_type_node)
! 		  && TYPE_PRECISION (t) < TYPE_PRECISION (integer_type_node)));
  
      case ENUMERAL_TYPE:
        /* ??? Technically all enumerations not larger than an int


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