Commit e233a3b2 by Anatoly Sokolov Committed by Anatoly Sokolov

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
parent bc492e47
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,
......
...@@ -2595,74 +2595,20 @@ try_combine (rtx i3, rtx i2, rtx i1, int *new_direct_jump_p) ...@@ -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))
{
ilo = INTVAL (inner);
ihi = ilo < 0 ? -1 : 0;
}
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; m = double_int_mask (width);
ohi = (ohi & ~mhi) | ihi; i = double_int_and (i, m);
m = double_int_lshift (m, offset, HOST_BITS_PER_DOUBLE_INT, false);
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);
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) ...@@ -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);
......
...@@ -147,6 +147,16 @@ double_int_ior (double_int a, double_int b) ...@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment