sign-extending integers

Joern Rennecke amylaar@cambridge.redhat.com
Mon Apr 23 21:10:00 GMT 2001


Here is another patch to sign-extend integers to the mode they are used in:

Tue Apr 24 04:53:08 2001  J"orn Rennecke <amylaar@redhat.com>

	* emit-rtl.c (constant_subword): Also do sign extension in
	BITS_PER_WORD == 16 case.

Index: emit-rtl.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/emit-rtl.c,v
retrieving revision 1.171
diff -p -r1.171 emit-rtl.c
*** emit-rtl.c	2001/04/07 15:39:58	1.171
--- emit-rtl.c	2001/04/24 03:52:29
*************** constant_subword (op, offset, mode)
*** 1387,1393 ****
  	  val = k[offset >> 1];
  	  if ((offset & 1) == ! WORDS_BIG_ENDIAN)
  	    val >>= 16;
! 	  val &= 0xffff;
  	  return GEN_INT (val);
  	}
        else
--- 1392,1398 ----
  	  val = k[offset >> 1];
  	  if ((offset & 1) == ! WORDS_BIG_ENDIAN)
  	    val >>= 16;
! 	  val = ((val & 0xffff) ^ 0x8000) - 0x8000;
  	  return GEN_INT (val);
  	}
        else
*************** constant_subword (op, offset, mode)
*** 1466,1472 ****
  	{
  	  if ((offset & 1) == ! WORDS_BIG_ENDIAN)
  	    val >>= 16;
! 	  val &= 0xffff;
  	}
  
        return GEN_INT (val);
--- 1471,1477 ----
  	{
  	  if ((offset & 1) == ! WORDS_BIG_ENDIAN)
  	    val >>= 16;
! 	  val = ((val & 0xffff) ^ 0x8000) - 0x8000;
  	}
  
        return GEN_INT (val);



More information about the Gcc-patches mailing list