This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
canonicalize BImode true
- To: gcc-patches at gcc dot gnu dot org
- Subject: canonicalize BImode true
- From: Richard Henderson <rth at cygnus dot com>
- Date: Mon, 18 Sep 2000 11:35:46 -0700
Without this, we sign-extend from bit 0 to get -1 as the canonical
value for true. If that were all, that would be no big deal.
However, if STORE_FLAG_VALUE is 1 (the most useful value for C,
which is otherwise arbitrary on ia64), combine decides that it
needs to insert various negations to get from -1 to 1, which
prevents various combinations from ocurring.
Since all that's required of trunc_int_for_mode et al is that they
be consistent, I choose to canonicalize BImode on STORE_FLAG_VALUE.
r~
* combine.c (if_then_else_cond): Canonicalize BImode true to
STORE_FLAG_VALUE.
* explow.c (trunc_int_for_mode): Likewise.
Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.153
diff -c -p -d -r1.153 combine.c
*** combine.c 2000/09/18 18:24:31 1.153
--- combine.c 2000/09/18 18:28:00
*************** if_then_else_cond (x, ptrue, pfalse)
*** 7418,7423 ****
--- 7433,7446 ----
|| ((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: explow.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/explow.c,v
retrieving revision 1.52
diff -c -p -d -r1.52 explow.c
*** explow.c 2000/07/23 17:12:04 1.52
--- explow.c 2000/09/18 18:28:00
*************** trunc_int_for_mode (c, mode)
*** 52,57 ****
--- 52,61 ----
{
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. */