(jump_optimize): Properly make jump into store-flag sequence when...
authorRichard Kenner <kenner@gcc.gnu.org>
Wed, 23 Jun 1993 11:52:14 +0000 (07:52 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Wed, 23 Jun 1993 11:52:14 +0000 (07:52 -0400)
(jump_optimize): Properly make jump into store-flag sequence when the
jump can't be reversed but the TRUE branch is const0_rtx.

From-SVN: r4715

gcc/jump.c

index c5da32a4aa7e66e2db2f372f67c65fc08118068e..9773ce61978f8834b1038c4eb3f78097e860f113 100644 (file)
@@ -1,5 +1,5 @@
 /* Optimize jump instructions, for GNU compiler.
-   Copyright (C) 1987, 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
+   Copyright (C) 1987, 88, 89, 91, 92, 1993 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -1155,10 +1155,22 @@ jump_optimize (f, cross_jump, noop_moves, after_regscan)
                                             1, OPTAB_WIDEN);
                    }
                  else if (normalizep != 1)
-                   target = expand_and (uval, target,
-                                        (GET_CODE (target) == REG
-                                         && ! preserve_subexpressions_p ()
-                                         ? target : NULL_RTX));
+                   {
+                     /* We know that either CVAL or UVAL is zero.  If
+                        UVAL is zero, negate TARGET and `and' with CVAL.
+                        Otherwise, `and' with UVAL.  */
+                     if (uval == const0_rtx)
+                       {
+                         target = expand_unop (GET_MODE (var), one_cmpl_optab,
+                                               target, NULL_RTX, 0);
+                         uval = cval;
+                       }
+
+                     target = expand_and (uval, target,
+                                          (GET_CODE (target) == REG
+                                           && ! preserve_subexpressions_p ()
+                                           ? target : NULL_RTX));
+                   }
                  
                  emit_move_insn (var, target);
                  seq = get_insns ();