double-int.h (double_int_and): New.

* double-int.h (double_int_and): New.
	* combine.c (try_combine): Clean up, use double_int_* and
	immed_double_int_const functions.

From-SVN: r159842
This commit is contained in:
Anatoly Sokolov 2010-05-25 23:48:40 +04:00 committed by Anatoly Sokolov
parent bc492e47c8
commit e233a3b258
3 changed files with 26 additions and 64 deletions

View File

@ -1,3 +1,9 @@
2010-05-25 Anatoly Sokolov <aesok@post.ru>
* double-int.h (double_int_and): New.
* combine.c (try_combine): Clean up, use double_int_* and
immed_double_int_const functions.
2010-05-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2010-05-25 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (gcc_cv_as_ld_jalr_reloc): Redirect grep stdout, * configure.ac (gcc_cv_as_ld_jalr_reloc): Redirect grep stdout,

View File

@ -2595,74 +2595,20 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
if (offset >= 0 if (offset >= 0
&& (GET_MODE_BITSIZE (GET_MODE (SET_DEST (temp))) && (GET_MODE_BITSIZE (GET_MODE (SET_DEST (temp)))
<= HOST_BITS_PER_WIDE_INT * 2)) <= HOST_BITS_PER_DOUBLE_INT))
{ {
HOST_WIDE_INT mhi, ohi, ihi; double_int m, o, i;
HOST_WIDE_INT mlo, olo, ilo;
rtx inner = SET_SRC (PATTERN (i3)); rtx inner = SET_SRC (PATTERN (i3));
rtx outer = SET_SRC (temp); rtx outer = SET_SRC (temp);
if (CONST_INT_P (outer)) o = rtx_to_double_int (outer);
{ i = rtx_to_double_int (inner);
olo = INTVAL (outer);
ohi = olo < 0 ? -1 : 0;
}
else
{
olo = CONST_DOUBLE_LOW (outer);
ohi = CONST_DOUBLE_HIGH (outer);
}
if (CONST_INT_P (inner)) m = double_int_mask (width);
{ i = double_int_and (i, m);
ilo = INTVAL (inner); m = double_int_lshift (m, offset, HOST_BITS_PER_DOUBLE_INT, false);
ihi = ilo < 0 ? -1 : 0; i = double_int_lshift (i, offset, HOST_BITS_PER_DOUBLE_INT, false);
} o = double_int_ior (double_int_and (o, double_int_not (m)), i);
else
{
ilo = CONST_DOUBLE_LOW (inner);
ihi = CONST_DOUBLE_HIGH (inner);
}
if (width < HOST_BITS_PER_WIDE_INT)
{
mlo = ((unsigned HOST_WIDE_INT) 1 << width) - 1;
mhi = 0;
}
else if (width < HOST_BITS_PER_WIDE_INT * 2)
{
mhi = ((unsigned HOST_WIDE_INT) 1
<< (width - HOST_BITS_PER_WIDE_INT)) - 1;
mlo = -1;
}
else
{
mlo = -1;
mhi = -1;
}
ilo &= mlo;
ihi &= mhi;
if (offset >= HOST_BITS_PER_WIDE_INT)
{
mhi = mlo << (offset - HOST_BITS_PER_WIDE_INT);
mlo = 0;
ihi = ilo << (offset - HOST_BITS_PER_WIDE_INT);
ilo = 0;
}
else if (offset > 0)
{
mhi = (mhi << offset) | ((unsigned HOST_WIDE_INT) mlo
>> (HOST_BITS_PER_WIDE_INT - offset));
mlo = mlo << offset;
ihi = (ihi << offset) | ((unsigned HOST_WIDE_INT) ilo
>> (HOST_BITS_PER_WIDE_INT - offset));
ilo = ilo << offset;
}
olo = (olo & ~mlo) | ilo;
ohi = (ohi & ~mhi) | ihi;
combine_merges++; combine_merges++;
subst_insn = i3; subst_insn = i3;
@ -2675,7 +2621,7 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p)
resulting insn the new pattern for I3. Then skip to where we resulting insn the new pattern for I3. Then skip to where we
validate the pattern. Everything was set up above. */ validate the pattern. Everything was set up above. */
SUBST (SET_SRC (temp), SUBST (SET_SRC (temp),
immed_double_const (olo, ohi, GET_MODE (SET_DEST (temp)))); immed_double_int_const (o, GET_MODE (SET_DEST (temp))));
newpat = PATTERN (i2); newpat = PATTERN (i2);

View File

@ -147,6 +147,16 @@ double_int_ior (double_int a, double_int b)
return a; return a;
} }
/* Returns A & B. */
static inline double_int
double_int_and (double_int a, double_int b)
{
a.low &= b.low;
a.high &= b.high;
return a;
}
/* Shift operations. */ /* Shift operations. */
double_int double_int_lshift (double_int, HOST_WIDE_INT, unsigned int, bool); double_int double_int_lshift (double_int, HOST_WIDE_INT, unsigned int, bool);
double_int double_int_rshift (double_int, HOST_WIDE_INT, unsigned int, bool); double_int double_int_rshift (double_int, HOST_WIDE_INT, unsigned int, bool);