public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* HOST_WIDE_INT = long long patches
@ 1998-04-19 15:57 John Carr
  1998-04-21 23:21 ` Jim Wilson
  1998-04-21 23:21 ` Jeffrey A Law
  0 siblings, 2 replies; 5+ messages in thread
From: John Carr @ 1998-04-19 15:57 UTC (permalink / raw)
  To: egcs

Sun Apr 19 15:27:53 1998  John Carr  <jfc@mit.edu>

	* final.c (split_double): Sign extend both halves of a split CONST_INT.

	* emit_rtl.c (gen_highpart): If HOST_WIDE_INT is larger than a target
	word, the high part of a CONST_INT is not always zero.

	* recog.c (constrain_operands): Allow CONST_INT in place of
	CONST_DOUBLE when HOST_WIDE_INT is larger than a target word.
	* reload.c (find_reloads): Likewise.


*** final.c~	Sat Apr  4 14:53:20 1998
--- final.c	Sun Apr 19 12:40:30 1998
***************
*** 3661,3676 ****
        if (HOST_BITS_PER_WIDE_INT >= (2 * BITS_PER_WORD))
  	{
  	  /* In this case the CONST_INT holds both target words.
! 	     Extract the bits from it into two word-sized pieces.  */
  	  rtx low, high;
- 	  HOST_WIDE_INT word_mask;
- 	  /* Avoid warnings for shift count >= BITS_PER_WORD.  */
- 	  int shift_count = BITS_PER_WORD - 1;
  
! 	  word_mask = (HOST_WIDE_INT) 1 << shift_count;
! 	  word_mask |= word_mask - 1;
! 	  low = GEN_INT (INTVAL (value) & word_mask);
! 	  high = GEN_INT ((INTVAL (value) >> (shift_count + 1)) & word_mask);
  	  if (WORDS_BIG_ENDIAN)
  	    {
  	      *first = high;
--- 3661,3672 ----
        if (HOST_BITS_PER_WIDE_INT >= (2 * BITS_PER_WORD))
  	{
  	  /* In this case the CONST_INT holds both target words.
! 	     Extract the bits from it into two word-sized pieces.
! 	     Sign extend each half to HOST_WIDE_INT.  */
  	  rtx low, high;
  
! 	  low = GEN_INT (INTVAL (value) << (HOST_BITS_PER_WIDE_INT - BITS_PER_WORD) >> (HOST_BITS_PER_WIDE_INT - BITS_PER_WORD));
! 	  high = GEN_INT (INTVAL (value) << (HOST_BITS_PER_WIDE_INT - 2 * BITS_PER_WORD) >> (HOST_BITS_PER_WIDE_INT - BITS_PER_WORD));
  	  if (WORDS_BIG_ENDIAN)
  	    {
  	      *first = high;
*** emit-rtl.c~	Sat Apr 18 07:40:05 1998
--- emit-rtl.c	Sun Apr 19 14:31:59 1998
***************
*** 984,990 ****
        )
      return GEN_INT (CONST_DOUBLE_HIGH (x) & GET_MODE_MASK (mode));
    else if (GET_CODE (x) == CONST_INT)
!     return const0_rtx;
    else if (GET_CODE (x) == MEM)
      {
        register int offset = 0;
--- 984,994 ----
        )
      return GEN_INT (CONST_DOUBLE_HIGH (x) & GET_MODE_MASK (mode));
    else if (GET_CODE (x) == CONST_INT)
!     {
!       if (HOST_BITS_PER_WIDE_INT <= BITS_PER_WORD)
! 	return const0_rtx;
!       return GEN_INT (INTVAL (x) >> (HOST_BITS_PER_WIDE_INT - BITS_PER_WORD));
!     }
    else if (GET_CODE (x) == MEM)
      {
        register int offset = 0;
*** reload.c~	Sat Apr  4 14:53:45 1998
--- reload.c	Sun Apr 19 14:10:12 1998
***************
*** 3054,3060 ****
  
  	      case 'G':
  	      case 'H':
! 		if (GET_CODE (operand) == CONST_DOUBLE
  		    && CONST_DOUBLE_OK_FOR_LETTER_P (operand, c))
  		  win = 1;
  		break;
--- 3054,3062 ----
  
  	      case 'G':
  	      case 'H':
! 		if ((GET_CODE (operand) == CONST_DOUBLE
! 		     || (HOST_BITS_PER_WIDE_INT > BITS_PER_WORD
! 			 && GET_CODE (operand) == CONST_INT))
  		    && CONST_DOUBLE_OK_FOR_LETTER_P (operand, c))
  		  win = 1;
  		break;
*** recog.c~	Fri Apr 17 15:57:25 1998
--- recog.c	Sun Apr 19 14:12:10 1998
***************
*** 1858,1864 ****
  
  	      case 'G':
  	      case 'H':
! 		if (GET_CODE (op) == CONST_DOUBLE
  		    && CONST_DOUBLE_OK_FOR_LETTER_P (op, c))
  		  win = 1;
  		break;
--- 1858,1866 ----
  
  	      case 'G':
  	      case 'H':
! 		if ((GET_CODE (op) == CONST_DOUBLE
! 		     || (HOST_BITS_PER_WIDE_INT > BITS_PER_WORD
! 			 && GET_CODE (op) == CONST_INT))
  		    && CONST_DOUBLE_OK_FOR_LETTER_P (op, c))
  		  win = 1;
  		break;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HOST_WIDE_INT = long long patches
  1998-04-19 15:57 HOST_WIDE_INT = long long patches John Carr
  1998-04-21 23:21 ` Jim Wilson
@ 1998-04-21 23:21 ` Jeffrey A Law
  1 sibling, 0 replies; 5+ messages in thread
From: Jeffrey A Law @ 1998-04-21 23:21 UTC (permalink / raw)
  To: John Carr; +Cc: egcs, wilson

  In message < 199804191934.PAA18086@jfc. >you write:
  > 
  > Sun Apr 19 15:27:53 1998  John Carr  <jfc@mit.edu>
  > 
  > 	* final.c (split_double): Sign extend both halves of a split CONST_INT.
  > 
  > 	* emit_rtl.c (gen_highpart): If HOST_WIDE_INT is larger than a target
  > 	word, the high part of a CONST_INT is not always zero.
  > 
  > 	* recog.c (constrain_operands): Allow CONST_INT in place of
  > 	CONST_DOUBLE when HOST_WIDE_INT is larger than a target word.
  > 	* reload.c (find_reloads): Likewise.
These look fine to me.  Please install this patch.

jeff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HOST_WIDE_INT = long long patches
  1998-04-19 15:57 HOST_WIDE_INT = long long patches John Carr
@ 1998-04-21 23:21 ` Jim Wilson
  1998-04-22  4:19   ` John Carr
  1998-04-21 23:21 ` Jeffrey A Law
  1 sibling, 1 reply; 5+ messages in thread
From: Jim Wilson @ 1998-04-21 23:21 UTC (permalink / raw)
  To: John Carr; +Cc: egcs

This change in final.c (split_double) doesn't look like it will work.

! 	  high = GEN_INT (INTVAL (value) << (HOST_BITS_PER_WIDE_INT - 2 * BITS_PER_WORD) >> (HOST_BITS_PER_WIDE_INT - BITS_PER_WORD));

If HOST_BITS_PER_WIDE_INT and BITS_PER_WORD are the same, then you end up with
a negative shift count for the first shift, which is undefined.

This change in reload.c (find_reloads) is unsafe.

! 		if ((GET_CODE (operand) == CONST_DOUBLE
! 		     || (HOST_BITS_PER_WIDE_INT > BITS_PER_WORD
! 			 && GET_CODE (operand) == CONST_INT))
  		    && CONST_DOUBLE_OK_FOR_LETTER_P (operand, c))

This is because some ports make the assumption that the input to
CONST_DOUBLE_OK_FOR_LETTER_P is a CONST_DOUBLE, and will fail if it isn't.
For instance, alpha.h references CONST_DOUBLE_{LOW,HIGH} without verifying
that it is a CONST_DOUBLE.  Also, if we are going to do this, we should
modify the CONST_DOUBLE_OK_FOR_LETTER_P documentation in tm.texi to indicate
that the operand could be either a CONST_DOUBLE or a CONST_INT.

Likewise, the similar change to recog.c is unsafe.

The emit-rtl.c change looks OK.

Jim

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HOST_WIDE_INT = long long patches
  1998-04-21 23:21 ` Jim Wilson
@ 1998-04-22  4:19   ` John Carr
  1998-04-22 12:13     ` Jim Wilson
  0 siblings, 1 reply; 5+ messages in thread
From: John Carr @ 1998-04-22  4:19 UTC (permalink / raw)
  To: Jim Wilson; +Cc: egcs

> This change in final.c (split_double) doesn't look like it will work.
> 
> ! 	  high = GEN_INT (INTVAL (value) << (HOST_BITS_PER_WIDE_INT - 2 * BITS_PER_WORD) >> (HOST_BITS_PER_WIDE_INT - BITS_PER_WORD));
> 
> If HOST_BITS_PER_WIDE_INT and BITS_PER_WORD are the same, then you end up with
> a negative shift count for the first shift, which is undefined.

The shift count is nonnegative because the code is inside a test:

      if (HOST_BITS_PER_WIDE_INT >= (2 * BITS_PER_WORD))


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: HOST_WIDE_INT = long long patches
  1998-04-22  4:19   ` John Carr
@ 1998-04-22 12:13     ` Jim Wilson
  0 siblings, 0 replies; 5+ messages in thread
From: Jim Wilson @ 1998-04-22 12:13 UTC (permalink / raw)
  To: John Carr; +Cc: egcs

	The shift count is nonnegative because the code is inside a test:
      if (HOST_BITS_PER_WIDE_INT >= (2 * BITS_PER_WORD))

Sorry, I didn't notice that.  I withdraw my complaint about the final.c
change.  It is OK.

Jim

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-04-22 12:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-04-19 15:57 HOST_WIDE_INT = long long patches John Carr
1998-04-21 23:21 ` Jim Wilson
1998-04-22  4:19   ` John Carr
1998-04-22 12:13     ` Jim Wilson
1998-04-21 23:21 ` Jeffrey A Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).