public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch for rs6000 const doubles
@ 1997-11-13  9:07 Michael Meissner
  1997-11-13 10:46 ` Jeffrey A Law
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Meissner @ 1997-11-13  9:07 UTC (permalink / raw)
  To: egcs

Jim or Jeff, please apply the following patch to the release branch of
egcs (I've already applied it to the development branch):

Thu Nov 13 11:07:41 1997  Michael Meissner  <meissner@cygnus.com>

	* rs6000.c (num_insns_constant): Use REAL_VALUE_FROM_CONST_DOUBLE to
	pick apart floating point values, instead of using CONST_DOUBLE_LOW
	and CONST_DOUBLE_HIGH.

	* rs6000.md (define_splits for DF constants): Use the appropriate
	REAL_VALUE_* interface to pick apart DF floating point constants in
	a machine independent fashion.

*** gcc/config/rs6000/rs6000.c.~1~	Fri Oct 24 14:18:02 1997
--- gcc/config/rs6000/rs6000.c	Thu Nov 13 11:05:36 1997
*************** num_insns_constant (op, mode)
*** 673,700 ****
        return num_insns_constant_wide ((HOST_WIDE_INT)l);
      }
  
!   else if (GET_CODE (op) == CONST_DOUBLE && TARGET_32BIT)
!     return (num_insns_constant_wide (CONST_DOUBLE_LOW (op))
! 	    + num_insns_constant_wide (CONST_DOUBLE_HIGH (op)));
! 
!   else if (GET_CODE (op) == CONST_DOUBLE && TARGET_64BIT)
      {
!       HOST_WIDE_INT low  = CONST_DOUBLE_LOW (op);
!       HOST_WIDE_INT high = CONST_DOUBLE_HIGH (op);
! 
!       if (high == 0 && (low & 0x80000000) == 0)
! 	return num_insns_constant_wide (low);
  
!       else if (((high & 0xffffffff) == 0xffffffff)
! 	       && ((low & 0x80000000) != 0))
! 	return num_insns_constant_wide (low);
  
!       else if (low == 0)
! 	return num_insns_constant_wide (high) + 1;
  
        else
! 	return (num_insns_constant_wide (high)
! 		+ num_insns_constant_wide (low) + 1);
      }
  
    else
--- 673,719 ----
        return num_insns_constant_wide ((HOST_WIDE_INT)l);
      }
  
!   else if (GET_CODE (op) == CONST_DOUBLE)
      {
!       HOST_WIDE_INT low;
!       HOST_WIDE_INT high;
!       long l[2];
!       REAL_VALUE_TYPE rv;
!       int endian = (WORDS_BIG_ENDIAN == 0);
  
!       if (mode == VOIDmode || mode == DImode)
! 	{
! 	  high = CONST_DOUBLE_HIGH (op);
! 	  low  = CONST_DOUBLE_LOW (op);
! 	}
!       else
! 	{
! 	  REAL_VALUE_FROM_CONST_DOUBLE (rv, op);
! 	  REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
! 	  high = l[endian];
! 	  low  = l[1 - endian];
! 	}
  
!       if (TARGET_32BIT)
! 	return (num_insns_constant_wide (low)
! 		+ num_insns_constant_wide (high));
  
        else
! 	{
! 	  if (high == 0 && (low & 0x80000000) == 0)
! 	    return num_insns_constant_wide (low);
! 
! 	  else if (((high & 0xffffffff) == 0xffffffff)
! 		   && ((low & 0x80000000) != 0))
! 	    return num_insns_constant_wide (low);
! 
! 	  else if (low == 0)
! 	    return num_insns_constant_wide (high) + 1;
! 
! 	  else
! 	    return (num_insns_constant_wide (high)
! 		    + num_insns_constant_wide (low) + 1);
! 	}
      }
  
    else
*** gcc/config/rs6000/rs6000.md.~1~	Mon Oct 27 11:56:16 1997
--- gcc/config/rs6000/rs6000.md	Thu Nov 13 10:39:59 1997
***************
*** 5734,5749 ****
    "
  {
    int endian = (WORDS_BIG_ENDIAN == 0);
    operands[2] = operand_subword (operands[0], endian, 0, DFmode);
    operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
! 
! #ifdef HOST_WORDS_BIG_ENDIAN
!   operands[4] = GEN_INT (CONST_DOUBLE_LOW  (operands[1]));
!   operands[5] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
! #else
!   operands[4] = GEN_INT (CONST_DOUBLE_HIGH (operands[1]));
!   operands[5] = GEN_INT (CONST_DOUBLE_LOW  (operands[1]));
! #endif
  }")
  
  (define_split
--- 5734,5749 ----
    "
  {
    int endian = (WORDS_BIG_ENDIAN == 0);
+   long l[2];
+   REAL_VALUE_TYPE rv;
+ 
+   REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
+   REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
+ 
    operands[2] = operand_subword (operands[0], endian, 0, DFmode);
    operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
!   operands[4] = GEN_INT (l[endian]);
!   operands[5] = GEN_INT (l[1 - endian]);
  }")
  
  (define_split
***************
*** 5762,5777 ****
    HOST_WIDE_INT high;
    HOST_WIDE_INT low;
    int endian = (WORDS_BIG_ENDIAN == 0);
    rtx high_reg = operand_subword (operands[0], endian, 0, DFmode);
    rtx low_reg  = operand_subword (operands[0], 1 - endian, 0, DFmode);
  
! #ifdef HOST_WORDS_BIG_ENDIAN
!   high = CONST_DOUBLE_LOW  (operands[1]);
!   low  = CONST_DOUBLE_HIGH (operands[1]);
! #else
!   high = CONST_DOUBLE_HIGH (operands[1]);
!   low  = CONST_DOUBLE_LOW  (operands[1]);
! #endif
  
    if (((unsigned HOST_WIDE_INT) (low + 0x8000) < 0x10000)
        || (low & 0xffff) == 0)
--- 5762,5776 ----
    HOST_WIDE_INT high;
    HOST_WIDE_INT low;
    int endian = (WORDS_BIG_ENDIAN == 0);
+   long l[2];
+   REAL_VALUE_TYPE rv;
    rtx high_reg = operand_subword (operands[0], endian, 0, DFmode);
    rtx low_reg  = operand_subword (operands[0], 1 - endian, 0, DFmode);
  
!   REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
!   REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
!   high = l[endian];
!   low  = l[1 - endian];
  
    if (((unsigned HOST_WIDE_INT) (low + 0x8000) < 0x10000)
        || (low & 0xffff) == 0)
***************
*** 5806,5814 ****
     (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 7)))]
    "
  {
!   HOST_WIDE_INT high = CONST_DOUBLE_HIGH (operands[1]);
!   HOST_WIDE_INT low  = CONST_DOUBLE_LOW  (operands[1]);
    int endian = (WORDS_BIG_ENDIAN == 0);
  
    operands[2] = operand_subword (operands[0], endian, 0, DFmode);
    operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);
--- 5805,5820 ----
     (set (match_dup 3) (ior:SI (match_dup 3) (match_dup 7)))]
    "
  {
!   HOST_WIDE_INT high;
!   HOST_WIDE_INT low;
!   long l[2];
!   REAL_VALUE_TYPE rv;
    int endian = (WORDS_BIG_ENDIAN == 0);
+ 
+   REAL_VALUE_FROM_CONST_DOUBLE (rv, operands[1]);
+   REAL_VALUE_TO_TARGET_DOUBLE (rv, l);
+   high = l[endian];
+   low  = l[1 - endian];
  
    operands[2] = operand_subword (operands[0], endian, 0, DFmode);
    operands[3] = operand_subword (operands[0], 1 - endian, 0, DFmode);

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

* Re: Patch for rs6000 const doubles
  1997-11-13  9:07 Patch for rs6000 const doubles Michael Meissner
@ 1997-11-13 10:46 ` Jeffrey A Law
  0 siblings, 0 replies; 2+ messages in thread
From: Jeffrey A Law @ 1997-11-13 10:46 UTC (permalink / raw)
  To: Michael Meissner; +Cc: egcs

  In message < 199711131707.MAA03473@tiktok.cygnus.com >you write:
  > Jim or Jeff, please apply the following patch to the release branch of
  > egcs (I've already applied it to the development branch):
  > 
  > Thu Nov 13 11:07:41 1997  Michael Meissner  <meissner@cygnus.com>
  > 
  > 	* rs6000.c (num_insns_constant): Use REAL_VALUE_FROM_CONST_DOUBLE to
  > 	pick apart floating point values, instead of using CONST_DOUBLE_LOW
  > 	and CONST_DOUBLE_HIGH.
  > 
  > 	* rs6000.md (define_splits for DF constants): Use the appropriate
  > 	REAL_VALUE_* interface to pick apart DF floating point constants in
  > 	a machine independent fashion.
Done.
jeff

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

end of thread, other threads:[~1997-11-13 10:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-13  9:07 Patch for rs6000 const doubles Michael Meissner
1997-11-13 10:46 ` 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).