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]

Re: mn10300 64-bit clean-up


On May 20, 2000, Alexandre Oliva <aoliva@cygnus.com> wrote:

> When HOST_BITS_PER_WIDE_INT is 64, a DI fits in a const_int, so we
> must properly break it into words.  No regressions, and apparently all
> testsuite differences between an ia32 host and an alpha host are
> gone.  Ok to install?

Two small improvements over the previous patch: instead of discarding
the sign of the lower word, sign-extend it, because then the assembler
may choose a smaller instruction.  Also, explicitly cast the words to
(long) when printing them as "%ld".  Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@cygnus.com>

	* config/mn10300/mn10300.md (movdi, movdf): 64-bit clean-up.
	* config/mn10300/mn10300.c (print_operand): Likewise.

Index: gcc/config/mn10300/mn10300.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10300/mn10300.c,v
retrieving revision 1.28
diff -u -p -c -r1.28 mn10300.c
*** gcc/config/mn10300/mn10300.c	2000/05/19 00:56:08	1.28
--- gcc/config/mn10300/mn10300.c	2000/05/20 17:26:04
*************** print_operand (file, x, code)
*** 177,183 ****
  	      }
  
  	  case CONST_INT:
! 	    print_operand_address (file, x);
  	    break;
  
  	  default:
--- 177,186 ----
  	      }
  
  	  case CONST_INT:
! 	    fprintf (file, "%ld",
! 		     (long)((INTVAL (x) << (HOST_BITS_PER_WIDE_INT - 32))
! 			    >> (HOST_BITS_PER_WIDE_INT - 32)));
! 
  	    break;
  
  	  default:
*************** print_operand (file, x, code)
*** 231,240 ****
  	      }
  
  	  case CONST_INT:
! 	    if (INTVAL (x) < 0)
! 	      print_operand_address (file, GEN_INT (-1));
!  	    else
! 	      print_operand_address (file, GEN_INT (0));
  	    break;
  	  default:
  	    abort ();
--- 234,240 ----
  	      }
  
  	  case CONST_INT:
! 	    fprintf (file, "%ld", (long)((INTVAL (x) >> 31) >> 1));
  	    break;
  	  default:
  	    abort ();
Index: gcc/config/mn10300/mn10300.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/mn10300/mn10300.md,v
retrieving revision 1.34
diff -u -p -c -r1.34 mn10300.md
*** gcc/config/mn10300/mn10300.md	2000/05/11 21:08:18	1.34
--- gcc/config/mn10300/mn10300.md	2000/05/20 17:26:05
***************
*** 420,426 ****
  	if (GET_CODE (operands[1]) == CONST_INT)
  	  {
  	    val[0] = INTVAL (operands[1]);
! 	    val[1] = val[0] < 0 ? -1 : 0;
  	  }
  	if (GET_CODE (operands[1]) == CONST_DOUBLE)
  	  {
--- 420,428 ----
  	if (GET_CODE (operands[1]) == CONST_INT)
  	  {
  	    val[0] = INTVAL (operands[1]);
! 	    val[1] = (val[0] >> 31) >> 1;
! 	    val[0] <<= HOST_BITS_PER_WIDE_INT - 32;
! 	    val[0] >>= HOST_BITS_PER_WIDE_INT - 32;
  	  }
  	if (GET_CODE (operands[1]) == CONST_DOUBLE)
  	  {
***************
*** 568,574 ****
  	if (GET_CODE (operands[1]) == CONST_INT)
  	  {
  	    val[0] = INTVAL (operands[1]);
! 	    val[1] = val[0] < 0 ? -1 : 0;
  	  }
  	if (GET_CODE (operands[1]) == CONST_DOUBLE)
  	  {
--- 570,578 ----
  	if (GET_CODE (operands[1]) == CONST_INT)
  	  {
  	    val[0] = INTVAL (operands[1]);
! 	    val[1] = (val[0] >> 31) >> 1;
! 	    val[0] <<= HOST_BITS_PER_WIDE_INT - 32;
! 	    val[0] >>= HOST_BITS_PER_WIDE_INT - 32;
  	  }
  	if (GET_CODE (operands[1]) == CONST_DOUBLE)
  	  {

-- 
Alexandre Oliva    Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company        aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist    CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org}   Write to mailing lists, not to me

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