]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
rs6000.c (num_insns_constant): Use REAL_VALUE_FROM_CONST_DOUBLE to pick apart floatin...
authorMichael Meissner <meissner@cygnus.com>
Thu, 13 Nov 1997 18:46:01 +0000 (18:46 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 13 Nov 1997 18:46:01 +0000 (11:46 -0700)
        * 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.

From-SVN: r16459

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.md

index 71ac727fb63faf56528b99cd36480e75c9e0023b..0677ec49e5471a432517af17813d1f02c71fe571 100644 (file)
@@ -1,3 +1,13 @@
+Thu Nov 13 11:47:55 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.
+
 Thu Nov 13 11:41:42 1997  Jeffrey A Law  (law@cygnus.com)
 
        * configure.in: Tweak NCR entries.
index c8ddbc1bb63563582f5a01d81acb489e941e6d63..497aa3f352894f22370cf85d6e48dbf9e9aea269 100644 (file)
@@ -673,28 +673,47 @@ num_insns_constant (op, mode)
       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)
+  else if (GET_CODE (op) == CONST_DOUBLE)
     {
-      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);
+      HOST_WIDE_INT low;
+      HOST_WIDE_INT high;
+      long l[2];
+      REAL_VALUE_TYPE rv;
+      int endian = (WORDS_BIG_ENDIAN == 0);
 
-      else if (((high & 0xffffffff) == 0xffffffff)
-              && ((low & 0x80000000) != 0))
-       return num_insns_constant_wide (low);
+      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];
+       }
 
-      else if (low == 0)
-       return num_insns_constant_wide (high) + 1;
+      if (TARGET_32BIT)
+       return (num_insns_constant_wide (low)
+               + num_insns_constant_wide (high));
 
       else
-       return (num_insns_constant_wide (high)
-               + num_insns_constant_wide (low) + 1);
+       {
+         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
index 39877c0d45858e1c12157db33a04af4652ed1c77..d707e0c8f0f6455ddf32198a889043ee2f2a2fd7 100644 (file)
   "
 {
   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);
-
-#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
+  operands[4] = GEN_INT (l[endian]);
+  operands[5] = GEN_INT (l[1 - endian]);
 }")
 
 (define_split
   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);
 
-#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
+  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)
    (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]);
+  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);
   operands[4] = GEN_INT (high & 0xffff0000);