combine.c (if_then_else_cond): Canonicalize BImode true to STORE_FLAG_VALUE.
authorRichard Henderson <rth@cygnus.com>
Mon, 18 Sep 2000 18:30:24 +0000 (11:30 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Mon, 18 Sep 2000 18:30:24 +0000 (11:30 -0700)
        * combine.c (if_then_else_cond): Canonicalize BImode true to
        STORE_FLAG_VALUE.
        * explow.c (trunc_int_for_mode): Likewise.

From-SVN: r36507

gcc/ChangeLog
gcc/combine.c
gcc/explow.c

index 2e1a280d33b9318667e286ed186da1e1e9906afd..ec5c66370e6bd31b1d182e56bcf40d7d835230f3 100644 (file)
@@ -1,5 +1,9 @@
 2000-09-18  Richard Henderson  <rth@cygnus.com>
 
+       * combine.c (if_then_else_cond): Canonicalize BImode true to
+       STORE_FLAG_VALUE.
+       * explow.c (trunc_int_for_mode): Likewise.
+
        * combine.c (combine_simplify_rtx): Use gen_unary to distribute
        the NOT for De Morgan's rule.
        * simplify-rtx.c (simplify_unary_operation): Simplify a BImode NOT
index 033bfac8d640f04743c4e68554193a1013b42459..b8ac09b766af853f7a7139c0d23feaaf06bbdb2d 100644 (file)
@@ -7418,6 +7418,14 @@ if_then_else_cond (x, ptrue, pfalse)
           || ((cond0 = get_last_value (x)) != 0 && CONSTANT_P (cond0)))
     ;
 
+  /* If we're in BImode, canonicalize on 0 and STORE_FLAG_VALUE, as that
+     will be least confusing to the rest of the compiler.  */
+  else if (mode == BImode)
+    {
+      *ptrue = GEN_INT (STORE_FLAG_VALUE), *pfalse = const0_rtx;
+      return x;
+    }
+
   /* If X is known to be either 0 or -1, those are the true and
      false values when testing X.  */
   else if (x == constm1_rtx || x == const0_rtx
index ce7118eeb17141e2a04a8f18c8c6782a1f901349..b2763e3abf0349952b155208eea9cd6183d04c03 100644 (file)
@@ -52,6 +52,10 @@ trunc_int_for_mode (c, mode)
 {
   int width = GET_MODE_BITSIZE (mode);
 
+  /* Canonicalize BImode to 0 and STORE_FLAG_VALUE.  */
+  if (mode == BImode)
+    return c & 1 ? STORE_FLAG_VALUE : 0;
+
   /* We clear out all bits that don't belong in MODE, unless they and our
      sign bit are all one.  So we get either a reasonable negative
      value or a reasonable unsigned value.  */