This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
unsigned combine losage
- To: kenner at vlsi1 dot ultra dot nyu dot edu
- Subject: unsigned combine losage
- From: Richard Henderson <rth at cygnus dot com>
- Date: Tue, 30 May 2000 17:56:42 -0700
- Cc: gcc-patches at gcc dot gnu dot org
Your March 25 unsigned spree broke get_pos_from_mask, since it
no longer reports failure of a contiguous bit range. This
results in rtl like
(insn 757 755 759 (set (zero_extract:DI (reg:DI 671)
(const_int -1 [0xffffffffffffffff])
(const_int 8 [0x8]))
(subreg:DI (reg:CC 668) 0)) 30 {*insv_internal} (nil)
(expr_list:REG_DEAD (reg:CC 668)
(nil)))
which is clearly nonsensical.
That aside, I'll take this opportunity to re-iterate my objection to the
indiscriminate unsignedness changing that's been going on in the recent
months. Just because the normal range of a particular value is non-negative
doesn't mean we never have call for out-of-band values, nor that we'll
never do subtractions.
r~
* combine.c (get_pos_from_mask): Test exact_log2 result as signed.
Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.133
diff -c -p -d -r1.133 combine.c
*** combine.c 2000/05/29 07:40:51 1.133
--- combine.c 2000/05/31 00:42:01
*************** get_pos_from_mask (m, plen)
*** 6588,6604 ****
{
/* Get the bit number of the first 1 bit from the right, -1 if none. */
int pos = exact_log2 (m & - m);
if (pos < 0)
return -1;
/* Now shift off the low-order zero bits and see if we have a power of
two minus 1. */
! *plen = exact_log2 ((m >> pos) + 1);
! if (*plen <= 0)
return -1;
return pos;
}
--- 6588,6606 ----
{
/* Get the bit number of the first 1 bit from the right, -1 if none. */
int pos = exact_log2 (m & - m);
+ int len;
if (pos < 0)
return -1;
/* Now shift off the low-order zero bits and see if we have a power of
two minus 1. */
! len = exact_log2 ((m >> pos) + 1);
! if (len <= 0)
return -1;
+ *plen = len;
return pos;
}