(maybe_eliminate_biv_1): In (set (cc0) <biv>) case, swap compare
authorRichard Kenner <kenner@gcc.gnu.org>
Sun, 18 May 1997 12:39:57 +0000 (08:39 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Sun, 18 May 1997 12:39:57 +0000 (08:39 -0400)
operands when mult_val < 0 in one additional place.

From-SVN: r14087

gcc/loop.c

index 64c1245977a97aa44f558a1b33151c80b70ee97e..1c2cbc2416193e9b9e2ac26fcc2fc2e4bb263f30 100644 (file)
@@ -6343,9 +6343,10 @@ maybe_eliminate_biv_1 (x, insn, bl, eliminate_p, where)
                emit_insn_before (gen_move_insn (tem, copy_rtx (v->add_val)),
                                  where);
 
-               if (validate_change (insn, &SET_SRC (PATTERN (insn)),
-                                    gen_rtx (COMPARE, VOIDmode,
-                                             v->new_reg, tem), 0))
+               /* Substitute the new register for its invariant value in
+                  the compare expression. */
+               XEXP (new, (INTVAL (v->mult_val) < 0) ? 0 : 1) = tem;
+               if (validate_change (insn, &SET_SRC (PATTERN (insn)), new, 0))
                  return 1;
              }
        }