]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
simplify-rtx.c (simplify_replace_rtx): Convert constant comparisons to MODE_FLOAT...
authorRoger Sayle <roger@eyesopen.com>
Wed, 16 Jul 2003 19:34:50 +0000 (19:34 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Wed, 16 Jul 2003 19:34:50 +0000 (19:34 +0000)
* simplify-rtx.c (simplify_replace_rtx): Convert constant comparisons
to MODE_FLOAT constants if FLOAT_STORE_FLAG_VALUE is defined.
(simplify_rtx): Likewise.  Simplify (lo_sum (high X) X) as X.

From-SVN: r69475

gcc/ChangeLog
gcc/simplify-rtx.c

index 4cfcc0cd7fc2d1d9543ba7287411fcd13db65cf1..ba9356f6e6c5e45b0dde2fad50f9dd7f6610b63e 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-16  Roger Sayle  <roger@eyesopen.com>
+
+       * simplify-rtx.c (simplify_replace_rtx): Convert constant comparisons
+       to MODE_FLOAT constants if FLOAT_STORE_FLAG_VALUE is defined.
+       (simplify_rtx): Likewise.  Simplify (lo_sum (high X) X) as X.
+
 2003-07-16  Andrew Pinski  <pinskia@physics.uc.edu>
        
        * doc/install.texi (--without-headers): New.
index 27fe4f377b67de6be2d29a1b6e976c71beb51c63..3b857673c720d8fd8396d9ac47cc392dff05d962 100644 (file)
@@ -269,15 +269,24 @@ simplify_replace_rtx (rtx x, rtx old, rtx new)
                                     : GET_MODE (XEXP (x, 1)));
        rtx op0 = simplify_replace_rtx (XEXP (x, 0), old, new);
        rtx op1 = simplify_replace_rtx (XEXP (x, 1), old, new);
-
-       return
-         simplify_gen_relational (code, mode,
-                                  (op_mode != VOIDmode
-                                   ? op_mode
-                                   : GET_MODE (op0) != VOIDmode
-                                   ? GET_MODE (op0)
-                                   : GET_MODE (op1)),
-                                  op0, op1);
+       rtx temp = simplify_gen_relational (code, mode,
+                                           (op_mode != VOIDmode
+                                            ? op_mode
+                                            : GET_MODE (op0) != VOIDmode
+                                              ? GET_MODE (op0)
+                                              : GET_MODE (op1)),
+                                           op0, op1);
+#ifdef FLOAT_STORE_FLAG_VALUE
+       if (GET_MODE_CLASS (mode) == MODE_FLOAT)
+       {
+         if (temp == const0_rtx)
+           temp = CONST0_RTX (mode);
+         else if (temp == const_true_rtx)
+           temp = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE (mode),
+                                                mode);
+       }
+#endif
+       return temp;
       }
 
     case '3':
@@ -3030,6 +3039,7 @@ simplify_rtx (rtx x)
 {
   enum rtx_code code = GET_CODE (x);
   enum machine_mode mode = GET_MODE (x);
+  rtx temp;
 
   switch (GET_RTX_CLASS (code))
     {
@@ -3058,12 +3068,24 @@ simplify_rtx (rtx x)
                                         XEXP (x, 2));
 
     case '<':
-      return simplify_relational_operation (code,
+      temp = simplify_relational_operation (code,
                                            ((GET_MODE (XEXP (x, 0))
                                              != VOIDmode)
                                             ? GET_MODE (XEXP (x, 0))
                                             : GET_MODE (XEXP (x, 1))),
                                            XEXP (x, 0), XEXP (x, 1));
+#ifdef FLOAT_STORE_FLAG_VALUE
+      if (temp != 0 && GET_MODE_CLASS (mode) == MODE_FLOAT)
+       {
+         if (temp == const0_rtx)
+           temp = CONST0_RTX (mode);
+         else
+           temp = CONST_DOUBLE_FROM_REAL_VALUE (FLOAT_STORE_FLAG_VALUE (mode),
+                                                mode);
+       }
+#endif
+      return temp;
+
     case 'x':
       if (code == SUBREG)
        return simplify_gen_subreg (mode, SUBREG_REG (x),
@@ -3074,8 +3096,20 @@ simplify_rtx (rtx x)
          if (CONSTANT_P (XEXP (x, 0)))
            return const1_rtx;
        }
-      return NULL;
+      break;
+
+    case 'o':
+      if (code == LO_SUM)
+       {
+         /* Convert (lo_sum (high FOO) FOO) to FOO.  */
+         if (GET_CODE (XEXP (x, 0)) == HIGH
+             && rtx_equal_p (XEXP (XEXP (x, 0), 0), XEXP (x, 1)))
+         return XEXP (x, 1);
+       }
+      break;
+
     default:
-      return NULL;
+      break;
     }
+  return NULL;
 }