* optabs.c (prepare_float_lib_cmp): Always attach a REG_EQUAL note
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Oct 2003 12:57:30 +0000 (12:57 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Oct 2003 12:57:30 +0000 (12:57 +0000)
to the comparison, as emit_libcall_block calls copy_rtx on equiv.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72262 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/optabs.c

index bfbdbcf..f9f4321 100644 (file)
@@ -1,3 +1,8 @@
+2003-10-09  Roger Sayle  <roger@eyesopen.com>
+
+       * optabs.c (prepare_float_lib_cmp): Always attach a REG_EQUAL note
+       to the comparison, as emit_libcall_block calls copy_rtx on equiv.
+
 2003-10-09  Dorit Naishlos  <dorit@il.ibm.com>
 
        * haifa-sched.c (ok_for_early_schedule): New function.
index 2f1fa4e..e29c92a 100644 (file)
@@ -3871,70 +3871,62 @@ prepare_float_lib_cmp (rtx *px, rtx *py, enum rtx_code *pcomparison,
       y = convert_to_mode (mode, y, 0);
     }
 
-  /* If we're optimizing attach a REG_EQUAL note describing the semantics
-     of the libcall to the RTL.  The allows the RTL optimizers to delete
-     the libcall if the condition can be determined at compile-time.  */
-  if (optimize
-      && ! side_effects_p (x)
-      && ! side_effects_p (y))
+  /* Attach a REG_EQUAL note describing the semantics of the libcall to
+     the RTL.  The allows the RTL optimizers to delete the libcall if the
+     condition can be determined at compile-time.  */
+  if (comparison == UNORDERED)
     {
-      if (comparison == UNORDERED)
-       {
-         rtx temp = simplify_gen_relational (NE, word_mode, mode, x, x);
-         equiv = simplify_gen_relational (NE, word_mode, mode, y, y);
-         equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode, word_mode,
-                                       temp, const_true_rtx, equiv);
-       }
-      else
+      rtx temp = simplify_gen_relational (NE, word_mode, mode, x, x);
+      equiv = simplify_gen_relational (NE, word_mode, mode, y, y);
+      equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode, word_mode,
+                                   temp, const_true_rtx, equiv);
+    }
+  else
+    {
+      equiv = simplify_gen_relational (comparison, word_mode, mode, x, y);
+      if (! FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
        {
-         equiv = simplify_gen_relational (comparison, word_mode, mode, x, y);
-         if (! FLOAT_LIB_COMPARE_RETURNS_BOOL (mode, comparison))
-           {
-             rtx true_rtx, false_rtx;
-
-             switch (comparison)
-               {
-               case EQ:
-                 true_rtx = const0_rtx;
-                 false_rtx = const_true_rtx;
-                 break;
+         rtx true_rtx, false_rtx;
 
-               case NE:
-                 true_rtx = const_true_rtx;
-                 false_rtx = const0_rtx;
-                 break;
-
-               case GT:
-                 true_rtx = const1_rtx;
-                 false_rtx = const0_rtx;
-                 break;
-
-               case GE:
-                 true_rtx = const0_rtx;
-                 false_rtx = constm1_rtx;
-                 break;
-
-               case LT:
-                 true_rtx = constm1_rtx;
-                 false_rtx = const0_rtx;
-                 break;
-
-               case LE:
-                 true_rtx = const0_rtx;
-                 false_rtx = const1_rtx;
-                 break;
-
-               default:
-                 abort ();
-               }
-             equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode,
-                                           word_mode, equiv,
-                                           true_rtx, false_rtx);
+         switch (comparison)
+           {
+           case EQ:
+             true_rtx = const0_rtx;
+             false_rtx = const_true_rtx;
+             break;
+
+           case NE:
+             true_rtx = const_true_rtx;
+             false_rtx = const0_rtx;
+             break;
+
+           case GT:
+             true_rtx = const1_rtx;
+             false_rtx = const0_rtx;
+             break;
+
+           case GE:
+             true_rtx = const0_rtx;
+             false_rtx = constm1_rtx;
+             break;
+
+           case LT:
+             true_rtx = constm1_rtx;
+             false_rtx = const0_rtx;
+             break;
+
+           case LE:
+             true_rtx = const0_rtx;
+             false_rtx = const1_rtx;
+             break;
+
+           default:
+             abort ();
            }
+         equiv = simplify_gen_ternary (IF_THEN_ELSE, word_mode, word_mode,
+                                       equiv, true_rtx, false_rtx);
        }
     }
-  else
-    equiv = NULL_RTX;
 
   start_sequence ();
   value = emit_library_call_value (libfunc, NULL_RTX, LCT_CONST,